cfischer
cfischer

Reputation: 24912

What Frameworks and imports are necessary to use AVAudioPlayer on iOS?

I'm trying to play 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?

Upvotes: 6

Views: 6256

Answers (2)

csano
csano

Reputation: 13716

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>

Upvotes: 3

Alex Kremer
Alex Kremer

Reputation: 2341

#import <AVFoundation/AVAudioPlayer.h> perhaps?

Upvotes: 14

Related Questions