Objective c Iphone sdk中AvAudioRecord的录制设置问题
在这里,当我在AvAudioRecord中设置recordsetting时,出现了一个异常Objective c Iphone sdk中AvAudioRecord的录制设置问题,objective-c,Objective C,在这里,当我在AvAudioRecord中设置recordsetting时,出现了一个异常 The code I written is as: 我创建了一个名为Record的按钮,在操作中,我将代码用作。。。 我导入了音频文件sound.caf [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryRecord error: nil]; NSDictionary *recordSettings
The code I written is as:
我创建了一个名为Record的按钮,在操作中,我将代码用作。。。
我导入了音频文件sound.caf
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryRecord error: nil];
NSDictionary *recordSettings; =[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 1], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax],
AVEncoderAudioQualityKey,nil];
AVAudioRecorder *newRecorder =[[AVAudioRecorder alloc] initWithURL: soundFileURL settings: recordSettings error: nil];
[recordSettings release];
self.soundRecorder = newRecorder;
[newRecorder release];
任何人的帮助都将不胜感激
谢谢,,
莫尼什·卡拉帕塔普。移除线路
[newRecorder release];
实际上,我在这一行得到了异常AVAudioRecorder*newRecorder=[[AVAudioRecorder alloc]initWithURL:soundFileURL设置:recordSettings错误:nil];即使在你的建议下,我还是删除了[newRecorder release]一行;如何创建soundFileURL?使用:NSString*tempDir=NSTemporaryDirectory();NSString*soundFilePath=[tempDir stringByAppendingString:@“sound.caf”];嘿,托马斯,帮我解决这个问题。