2014-03-12 20 views
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]; 
} 

回答

0

我有同樣的錯誤。原來是前鋒課題。實際上,檢查是否有相同的代碼行(錯誤的一行)也會標記出其他警告。礦井正在顯示前方的警告。當我排除這個錯誤也被排序。