【发布时间】:2011-11-09 13:32:20
【问题描述】:
我正在尝试使用 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
这是我按下按钮时应该播放声音的代码:
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];
}
我是否以某种方式将文件放在了错误的位置?我只是将文件拖到项目中并在需要时选择副本。
编辑:经过更多测试,我发现在运行 IOS 4.2 模拟器时我没有收到此错误,仅在 IOS 5 模拟器上。我可以假设这是 iOS 5 中的错误吗?
谢谢,
【问题讨论】:
标签: iphone objective-c ios avaudioplayer