Ios5 在ios中播放mp3文件失败
可能重复:Ios5 在ios中播放mp3文件失败,ios5,avaudioplayer,Ios5,Avaudioplayer,可能重复: 我对iphone应用程序的开发还很陌生。我想在我的应用程序中播放.mp3文件。 这是我尝试使用的代码片段。“dd.mp3”是支持文件下的文件。但它不起作用。我做错什么了吗 NSError *error=nil; NSURL *audioURL =[[NSBundle mainBundle] URLForResource:@"dd" withExtension:@"mp3"]; AVAudioPlayer *avPlayerObject = [[AVAudioPlayer alloc
我对iphone应用程序的开发还很陌生。我想在我的应用程序中播放.mp3文件。 这是我尝试使用的代码片段。“dd.mp3”是支持文件下的文件。但它不起作用。我做错什么了吗
NSError *error=nil;
NSURL *audioURL =[[NSBundle mainBundle] URLForResource:@"dd" withExtension:@"mp3"];
AVAudioPlayer *avPlayerObject = [[AVAudioPlayer alloc] initWithContentsOfURL:audioURL error:&error];
if(avPlayerObject)
{
[avPlayerObject play];
}
当我运行这段代码时,我得到以下错误输出
2012-08-08 06:46:30.802服务测试[408:10703]加载错误/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/audioipcpplugin:dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/audioipcpplugin.bundle/Contents/MacOS/audioipcpplugin,262):找不到符号:\ uuuuuuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:30.895 serviceTest[408:10703]加载错误/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/audioipcpplugin:dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/audioipcpplugin.bundle/Contents/MacOS/audioipcpplugin,262):找不到符号:\ uuuuuuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.196服务测试[408:10703]加载错误/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):找不到符号:uuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.221服务测试[408:10703]加载错误/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):找不到符号:uuuu cfobjcollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.276 serviceTest[408:10703]加载错误/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):找不到符号:uuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.301服务测试[408:10703]加载错误/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):找不到符号:uuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.358 serviceTest[408:10703]加载错误/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):找不到符号:uuuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
在/System/Library/Frameworks/Security.framework/Versions/A/Security中
2012-08-08 06:46:31.382 serviceTest[408:10703]加载错误/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):找不到符号:uuuu CFObjCIsCollectable
引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
应位于:/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/System/Library/Frameworks/corefundation.framework/corefundation
in/System/Library/Frameworks/Securit
NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"caf"];
self.audioPlayer =[[AVAudioPlayer alloc]initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[self.audioPlayer setDelegate:self];
[self.audioPlayer prepareToPlay];
[self.audioPlayer play];