2011-08-16 49 views
1

下面的代碼引發了OSStatus錯誤1718449215,根據Audio Queue Reference,錯誤代碼爲「播放數據格式不受支持」。iOS上的AVAudioRecorder錯誤「播放數據格式不受支持」?

如果我將AVFormatKey更改爲kAudioFormatiLBCkAudioFormatLinearPCM,代碼正常工作。是否使用iOS支持的kAudioFormatMPEG4AAC_HE進行錄製?

NSDictionary *settings = 
    [NSDictionary dictionaryWithObjectsAndKeys: 
    [NSNumber numberWithFloat: 32000.0],    AVSampleRateKey, 
    [NSNumber numberWithInt: kAudioFormatMPEG4AAC_HE], AVFormatIDKey, 
    [NSNumber numberWithInt: 1],      AVNumberOfChannelsKey, 
    [NSNumber numberWithInt: AVAudioQualityMedium],  AVEncoderAudioQualityKey, 
nil]; 

NSError *error = nil; 
AVAudioRecorder *avRecorder = [[AVAudioRecorder alloc] 
           initWithURL:url 
           settings:settings 
           error:&error]; 

NSAssert(error.code != 1718449215, @"The playback data format is unsupported."); 

回答

相關問題