title: iOS 7 Bluetooth Output not working for AVAudioSessionCategoryPlayAndRecord
body: <p>In my app, if iPhone is connected to Bluetooth headset, play sound with Bluetooth. Else use default speaker.</p>
  
  <p>Here's my code</p>
  
  <pre><code>[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionAllowBluetooth error:nil];
  [[AVAudioSession sharedInstance] setMode:AVAudioSessionModeVoiceChat error:nil];
  [[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideNone error:nil];
  [[AVAudioSession sharedInstance] setActive:YES error:nil];
  </code></pre>
  
  <p>However, when I tried to use category setCategory:AVAudioSessionCategoryPlayAndRecord. Route to bluetooth device stopped working.. I don't know why. Because by right, the bluetooth option should only work for Record or PlayAndRecord category...</p>
  
  <blockquote>
    <p>/* only valid with AVAudioSessionCategoryRecord and AVAudioSessionCategoryPlayAndRecord */</p>
  </blockquote>
  
  <p>Addition: Can I have bluetooth for output ONLY (input still use default Mic from phone)?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I changed the order by calling setMode first, followed by setCategory. It works for the first time running the application (a call). When I tried to do the same action again, currentRoute still gave me output = Bluetooth but the actual output returns to default phone front speaker.</p>