![](/img/trans.png)
[英]Recording audio on iPhone: error with setPreferredIOBufferDuration
[英]Error recording audio in iPhone Simulator
使用AVFoundation在iPhone模擬器中錄制音頻時出現以下錯誤。 我的代碼在設備上工作正常。
有任何想法嗎? 提前致謝。
2012-09-15 17:51:39.592 MySpellings [538:3503]加載/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn:dlopen(/ System / Library /擴展名/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn,262):找不到符號:__ CFObjCIsCollectable引用自:/System/Library/Frameworks/Security.framework/Versions/A/Security
預期存在於:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation在/ System / Library / Frameworks / Security中.framework / Versions / A / Security 2012-09-15 17:51:39.598 MySpellings [538:3503]加載/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugInIn時出錯:dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn,262):找不到符號:_ _CFObjCIsCollectable引用自:/ System / Library / Framework / Security。 /版本/ A /安全
預期存在於:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation在/ System / Library / Frameworks / Security中.framework / Versions / A / Security 2012-09-15 17:51:39.607 MySpellings [538:3503]加載/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugInIn時出錯:dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn,262):找不到符號:__ CFObjCIsCollectable引用自:/System/Library/Frameworks/Security.frame /版本/ A /安全
預期存在於:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation在/ System / Library / Frameworks / Security中.framework / Versions / A / Security 2012-09-15 17:51:39.612 MySpellings [538:3503]加載/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugInIn時出錯:dlopen(/System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHALPlugIn.bundle/Contents/MacOS/AppleHDAHALPlugIn,262):找不到符號:_ _CFObjCIsCollectable引用自:/ System / Library / Framework / Security。 /版本/ A /安全
預期存在於:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation在/ System / Library / Frameworks / Security中.framework / Versions / A / Security 2012-09-15 17:51:40.932 MySpellings [538:4907] aq @ 0xea13200:ConvertInput:AudioConverterFillComplexBuffer返回560226676,packetCount 21 2012-09-15 17:51:42.254 MySpellings [538: [c07]刷新暫掛輸入已終止-錯誤'!dat'
在我的情況下,顯示此錯誤是因為我使用了錯誤的比特率:
我忘了我使用Kbps,而AVEncoderBitRateKey
使用bps。 因此,在將比特率乘以1000
,錯誤消失了。
在錄制為m4a格式(AVFormatIDKey = kAudioFormatMPEG4AAC)時,在模擬器中錄制音頻時也遇到了問題。 沒有錄制音頻,控制台日志包含“ AudioConverterFillComplexBuffer”錯誤。
但是,錄制為.caf格式(kAudioFormatAppleIMA4)確實可行,這對於某些人而言可能是一種解決方法。
recordSettings = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],
AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 1],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:16000.0],
AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleIMA4],
AVFormatIDKey,
nil];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.