What frameworks and imports are required to use AVAudioPlayer on iOS?

I am trying to play sound on iOS using AVAudioPlayer. I added AVFoundation.framework and MediaPlayer.framework and tried to import AVAudioPlayer.h (this part did not work), but I still cannot create an instance of the AVAudioPlayer class.

What am I doing wrong?

+6
source share
2 answers

#import <AVFoundation/AVAudioPlayer.h> maybe?

+14
source

According to the Apple documentation , AVAudioPlayer is available with iOS 2.2.

Make sure you use the following import:

 #import <AVFoundation/AVAudioPlayer.h> 
+3
source

Source: https://habr.com/ru/post/890791/


All Articles