Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
As you can see, using audio in an iOS app is straightforward. When special circumstances are considered because of the nature of iOS audio sessions, your app can present both a rich and immersive experience using audio. If you want to offer a user access to their existing music library, use the MPMusicPlayerController. Remember, the type of music player controller used will determine the impact your app has on the user’s existing iPod audio session.
If you’re working with audio resources stored in your application sandbox, you will want to use the AV Foundation-based player, AVAudioPlayer. Use the AVAudioSession to manage the behavior of this player as it interacts with other audio sources.
Finally, when working with audio on iOS, remember two important things. First, be conscious of when and why your app should take precedence over an existing audio session. And second, be prepared for your audio session to be interrupted by system events like incoming phone calls, FaceTime alerts, or other system-based alarms.