我設法設置AVAudiorecorder進行錄製,但我想將錄製文件保存在文檔目錄中以稍後收聽。我嘗試這樣做:保存AVAudioRecording路徑
- (void) audioRecorderDidFinishRecording:(AVAudioRecorder *)avrecorder successfully:(BOOL)flag{
ButtonStopRecording.hidden = YES;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"audioFile.ext"]; // Where ext is the audio format extension you have recorded your sound
[avrecorder.data writeToFile:filePath atomically:YES];
}
但在
avrecorder.data
錯誤我該如何解決這個問題?
現在您必須知道,如果您發佈有關錯誤的問題,則應在問題中包含完整的錯誤。 – rmaddy