What Frameworks and imports are necessary to use AVAudioPlayer on iOS?
I'm trying to play 开发者_StackOverflow社区a sound on iOS using AVAudioPlayer. I added the AVFoundation.framework and MediaPlayer.framework and tried to import AVAudioPlayer.h (this part didn't work), but I still can't instantiate the AVAudioPlayer class.
What am I doing wrong?
#import <AVFoundation/AVAudioPlayer.h>
perhaps?
According to the Apple documentation, AVAudioPlayer has been available since iOS 2.2.
Make sure you're using the following import:
#import <AVFoundation/AVAudioPlayer.h>
精彩评论