【问题标题】:What Frameworks and imports are necessary to use AVAudioPlayer on iOS?在 iOS 上使用 AVAudioPlayer 需要哪些框架和导入?
【发布时间】:2011-06-17 21:30:35
【问题描述】:

我正在尝试使用 AVAudioPlayer 在 iOS 上播放声音。我添加了 AVFoundation.framework 和 MediaPlayer.framework 并尝试导入 AVAudioPlayer.h (这部分不起作用),但我仍然无法实例化 AVAudioPlayer 类。

我做错了什么?

【问题讨论】:

    标签: objective-c cocoa-touch avaudioplayer


    【解决方案1】:

    #import <AVFoundation/AVAudioPlayer.h> 或许?

    【讨论】:

      【解决方案2】:

      根据 Apple documentation 的说法,AVAudioPlayer 从 iOS 2.2 开始就可以使用。

      确保您使用的是以下导入:

      #import <AVFoundation/AVAudioPlayer.h>
      

      【讨论】:

        猜你喜欢
        • 2012-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-06-26
        • 1970-01-01
        • 2016-08-13
        相关资源
        最近更新 更多