- A player instance variable needs to be added to your class, e.g. AVAudioPlayer *player.
- The AVAudioPlayer class needs to be imported in the header file, i.e. add this line to the top of the class's header file: #import
- Make your class a AVAudioPlayerDelegate. In your class's @interface declaration, add AVAudioPlayerDelegate to the list of implemented protocols.
- Add the AVFoundation framework to your app's link libraries. In XCode's "Group & Files" pane, expand Targets > [your app name]. Right-click on Link Binary With Libraries and select Add > Existing Frameworks. Select AVFoundation.framework and click Add.
Also worth noting: here's a good tip on making the music fade out.

No comments:
Post a Comment