简体   繁体   中英

Error recording audio in iPhone Simulator

I'm getting the following error when recording audio in the iPhone Simulator using AVFoundation. My code works fine on device.

Any ideas? Thanks in advance.

2012-09-15 17:51:39.592 MySpellings[538:3503] 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: /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-09-15 17:51:39.598 MySpellings[538:3503] 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: /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-09-15 17:51:39.607 MySpellings[538:3503] 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: /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-09-15 17:51:39.612 MySpellings[538:3503] 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: /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-09-15 17:51:40.932 MySpellings[538:4907] aq@0xea13200: ConvertInput: AudioConverterFillComplexBuffer returned 560226676, packetCount 21 2012-09-15 17:51:42.254 MySpellings[538:c07] flushing pending input terminated - error '!dat'

In my case that error was shown because I used wrong bitrate:

I forgot that I used Kbps and AVEncoderBitRateKey uses bps. So, after I multiplied bitrate to 1000 , error gone.

I also had problems recording audio in the simulator when recording to m4a format (AVFormatIDKey = kAudioFormatMPEG4AAC). No audio was recorded an the console log contained an error for "AudioConverterFillComplexBuffer".

However, recording to .caf format (kAudioFormatAppleIMA4) does work and this might be a workaround solution for some people.

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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM