0
我在努力更新現有的項目,現在拋出錯誤記錄使用audioRecorder與initWithURL
「initWithURL:」不可用:不適用於iOS
這是最奇怪的項目已在以前版本的Xcode(現在使用5)上工作得很好
-(void)startRecording
{
//NSInteger currCount = [[NSUserDefaults standardUserDefaults] integerForKey:AUDIO_FILENAME_COUNT];
NSString *caldate [email protected]"record";
recorderFilePath = [[NSString stringWithFormat:@"%@/%@.mp4", DOCUMENTS_FOLDER, caldate] retain];
CFStringRef fileString = (CFStringRef) recorderFilePath;
CFURLRef fileURL = CFURLCreateWithFileSystemPath (NULL,fileString,kCFURLPOSIXPathStyle,false);
NSLog (@"Recorded file path: %@", fileURL);
if (fileURL) {
soundFileURL = (NSURL *) fileURL;
//CFRelease (fileURL);
}
UInt32 doChangeDefaultRoute = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
sizeof (doChangeDefaultRoute),
&doChangeDefaultRoute);
//kAudioSessionProperty_OverrideCategoryDefaultToSpeaker
if (audioRecorder)
{
[audioRecorder release];
audioRecorder = nil;
}
audioRecorder = [[AudioRecorder alloc] initWithURL: soundFileURL];
[audioRecorder setNotificationDelegate: self]; // sets up the recorder object to receive property change notifications
AudioSessionSetActive(true);
[audioRecorder record];
[self dismissModalViewControllerAnimated:YES];
}