6

The iPhone I'm using for development only outputs sounds through the headphones for all the apps I'm running from xcode. Other apps (like Youtube or iTunes) play sound just fine, and also building and testing the very same apps on a different device (an iPad) works perfectly. Running the apps in simulator also works as intended.

I'm using:

  • Xcode 6 (working in Swift 1.2)
  • AVFoundation library and AVAudioPlayer
  • iPhone 6 Plus (with iOS 8.4.1)
  • the phone is not in silent mode

Any tips or hints would be appreciated. Thanks

Marius Pop
  • 334
  • 2
  • 6

1 Answers1

2

Sometimes the audio route can get a bit messed up.

You should listen to the audio route changes using the AVAudioSessionRouteChangeNotification

See HandlingAudioHardwareRouteChanges

You can also force the audio route if needed. Working with Audio Input and Output Routes

Oh, and also check the reason for the change to know why its happening on that app. AVAudioSessionRouteChangeReason

some_id
  • 29,466
  • 62
  • 182
  • 304