我正在尝试播放链接到按钮的声音,但我收到以下错误代码。我该如何解决这个问题?
2012-01-13 07:22:58.887 M3NYFAC3Z [5875:1e03]加载错误 /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen的(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262):找不到符号:_CFXMLNodeGetInfoPtr引用自: /System/Library/Frameworks/Security.framework/Versions/A/Security
期望: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 在/System/Library/Frameworks/Security.framework/Versions/A/Security中 2012-01-13 07:22:58.892 M3NYFAC3Z [5875:1e03]加载错误 /System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn: dlopen的(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn, 262):找不到符号:_CFXMLNodeGetInfoPtr引用自: /System/Library/Frameworks/Security.framework/Versions/A/Security
期望: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 在/System/Library/Frameworks/Security.framework/Versions/A/Security中 2012-01-13 07:25:28.994 M3NYFAC3Z [5875:1e03] AQMEIO_Base :: DoStartIO: 超时2012-01-13 07:25:29.271 M3NYFAC3Z [5875:1e03] AQMEDevice(0x8831a00):: StartIO:error -66681 2012-01-13 07:25:29.272 M3NYFAC3Z [5875:1e03] CA_UISoundClientBase :: StartPlaying: AddRunningClient失败(状态= -66681)。 [切换到过程5875 线程0x207] sharedlibrary apply-load-rules all
这是我的代码:
-(IBAction)playobey:(id)sender {
NSString *path = [[NSBundle mainBundle] pathForResource:@"renegadeyamaha" ofType:@"wav"];
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[audioPlayer play];
}
答案 0 :(得分:3)
您需要在某处的ivar / property中保留对AVAudioPlayer的引用。它可能正在创建,然后在它有机会完成播放声音之前立即发布。
我写了一个基于AVAudioPlayer的小型声音播放器类,可以让你的生活更轻松: