AVAudioPlayer错误加载文件

Kyl*_*uth 23 iphone objective-c avaudioplayer ios

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

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
Run Code Online (Sandbox Code Playgroud)

这是我的代码,按下我的按钮时应播放声音:

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];
}
Run Code Online (Sandbox Code Playgroud)

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

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

谢谢,

小智 22

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