AVAudioPlayer错误加载文件 [英] AVAudioPlayer error loading file

查看:85
本文介绍了AVAudioPlayer错误加载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AVAudioPlayer播放一个简单的声音,我一直在控制台中收到此错误:

I am trying to use the AVAudioPlayer to play a simple sound and I keep getting this error in the console:

2011-09-02 20:29:07.369 MusicLog[967:10103] Error loading /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:  dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn, 262): Symbol not found: ___CFObjCIsCollectable
  Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
  Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
 in /System/Library/Frameworks/Security.framework/Versions/A/Security

这是我的代码,当我的按钮是按下:

Here is my code that should play a sound when my button is pressed:

NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"tick" ofType:@"caf"];
NSError *error;

    NSURL *soundURL = [NSURL fileURLWithPath:soundPath];
    AVAudioPlayer *tickPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:&error];
[tickPlayer setDelegate:self];
[tickPlayer setNumberOfLoops:0];
[tickPlayer prepareToPlay];
if (tickPlayer == nil)
{
    NSLog(@"%@", [error description]);
}
else
{
    [tickPlayer play];
}

我是否以某种方式将文件放在错误的位置?我只是将文件拖入项目并根据需要选择副本。

Do I somehow have the file in the wrong place? I just dragged the file into the project and selected copy if needed.

编辑:经过更多测试后我发现运行IOS 4.2时没有出现此错误模拟器,仅在IOS 5模拟器上。我可以假设这是iOS 5中的错误吗?

谢谢,

推荐答案

我遇到了同样的问题。它似乎只是iOS5模拟器中的一个问题。我还没有在iOS 5设备上测试过。我一直希望XCode升级会让错误消失,但到目前为止还没有运气。

I've had the same problem. It only seems to be a problem on iOS5 in simulator. I haven't tested on an iOS 5 device yet. I keep hoping XCode upgrades will make the error go away, but so far no luck.

这篇关于AVAudioPlayer错误加载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆