我正在努力更新现在抛出错误的现有项目
'initWithURL:'不可用:iOS上不可用
最奇怪的是,该项目在以前版本的Xcode(现在使用5)
上运行良好-(void)startRecording
{
//NSInteger currCount = [[NSUserDefaults standardUserDefaults] integerForKey:AUDIO_FILENAME_COUNT];
NSString *caldate =@"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];
}
答案 0 :(得分:0)
我有同样的错误。结果证明是前瞻性问题。实际上检查同一行代码(错误的一行)是否也标出了其他一些警告。我正在展示前哨警告。当我解决这个错误时,这个错误也被排序了。