gpt4 book ai didi

iphone - 音频文件不使用 iphone sdk 播放

转载 作者:搜寻专家 更新时间:2023-10-30 20:25:57 24 4
gpt4 key购买 nike

我正在尝试在我的 iPhone 应用程序中播放音频文件。我已经使用了这段代码

#import <AVFoundation/AVFoundation.h>

NSBundle *bundle = [NSBundle mainBundle];
NSString *musicPath = [bundle pathForResource:@"audioSample" ofType:@"mp3"];
NSURL *musicURL = [NSURL fileURLWithPath:musicPath];
NSError *error= [NSError errorWithDomain:@"Domain" code:0 userInfo:nil];

AVAudioPlayer *aplayer= [[AVAudioPlayer alloc] initWithContentsOfURL:musicURL error:&error];
aplayer.delegate = self;
[aplayer play];

但是将运行这个应用程序我得到这个错误。任何人都可以帮我解决这个问题。我不明白为什么会发生这个错误。

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): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-08-03 10:12:07.330 SampleAudioCode[591:12003] Error loading /Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio: dlopen(/Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin/Contents/MacOS/Digidesign CoreAudio, 262): Symbol not found: ___CFObjCIsCollectable
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
2012-08-03 10:12:07.330 SampleAudioCode[591:12003] Cannot find function pointer NewDigiCoreAudioPlugIn for factory B8A063B5-2F3D-444A-88CB-D0B8F1B22042 in CFBundle/CFPlugIn 0xdc50f50 </Library/Audio/Plug-Ins/HAL/Digidesign CoreAudio.plugin> (bundle, not loaded)

谢谢你的回答..

最佳答案

这似乎是仅使用 iOS 模拟器时 AVAudio 框架的问题。在实际硬件上进行测试(在我的例子中是 iPad 2 和 iPad 1)不会产生这些相同的错误

这个错误只是来自系统框架的控制台噪音,你应该忽略它,它不会影响你。如果您的应用程序崩溃或无法播放,真正的原因在别处。

and please also add CoreFoundation framwork.

关于iphone - 音频文件不使用 iphone sdk 播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11789569/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com