Problems with AVAudioPlayer

烂漫一生 提交于 2019-12-04 05:05:23

You need to add the AVFoundation framework to your project. (right-click on your main target then add existing framework).

To add to the other answers.

You should always look at the documentation of a class 'I.e AVAudioPlayer. That you are unfamiliar with when you intend to use it. There at the top of the documentation ( Class Reference) for the the Class, is a table showing what framework the class belongs to:

Once you know this add the framework to the project. And also import it into the header (.h) file as others have pointed out

thank you, it worked. I didn't know that I have to add the Framework :S

I used the following instructions:

  1. In the project navigator, select your project
  2. Select your target
  3. Select the 'Build Phases' tab
  4. Open 'Link Binaries With Libraries' expander
  5. Click the '+' button
  6. Select your framework

Pls add the AVFoundation framework to your project. And i think you should add <AVFoundation/AVFoundation.h> along with <AudioToolbox/AudioToolbox.h>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!