1
我試圖記錄和saave MP3文件,所以我用下面的代碼記錄音頻文件爲MP3或WAV
NSString* d = @" ar/mobile/Applications/86F15C5E-66EC-4071-95EB-96CDE64B5948/Library/Application Support/P/5720/5720/Report/Report0.mp3"
NSURL *soundFileURL = [NSURL fileURLWithPath:d];
NSDictionary *recordSettings = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],
AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:44100.0],
AVSampleRateKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc]
initWithURL:soundFileURL
settings:recordSettings
error:&error];
if (error)
{
NSLog(@"error: %@", [error localizedDescription]);
} else {
[audioRecorder prepareToRecord];
}
,並開始我使用記錄
[audioRecorder record];
的MP3我得到錯誤 錯誤:操作無法完成。 (OSStatus錯誤1718449215.)
,如果我保存爲WAV沒有被記錄,並且該文件是0字節
我失去的東西,任何想法如何解決
我更新的代碼 – AMH 2012-02-16 14:27:40