2010-05-18 74 views
0

我想用aac格式初始化AVAudioRecorder。爲此,我使用以下代碼:iphone sdk:AVAudioRecorder的初始化返回零

soundFilePath = [soundFilePath stringByAppendingPathExtension:@"aac"];NSURL *url = 
[NSURL fileURLWithPath:soundFilePath isDirectory:FALSE]; 

NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init]; 
[recordSetting setValue:[NSNumber numberWithInt: 'aac '] forKey:AVFormatIDKey];          
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVEncoderAudioQualityKey];    //Encoder Settings 
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityMin] forKey:AVSampleRateConverterAudioQualityKey]; //Sample Rate Conversion Settings 

_recorder = [[AVAudioRecorder alloc] initWithURL:url settings:recordSetting error:nil]; 

爲什麼不能正常工作? Id確實有用,如果我將aac更改爲ima4!

回答

0

'aac'不在預定義的格式ID中,因此它不起作用。 U可以查看支持的聽覺型常量以獲取所有這些列表。他們可以在常量部分獲得here