2013-03-01 51 views
0
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 

    //added other code 

    [self dismissModalViewControllerAnimated:YES]; 

      UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"Photo added to library" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil]; 
      [alert show]; 
} 

在我的應用程序中顯示「Bad access Error」錯誤後,如果我刪除了Alertbox,那很好。我的代碼有什麼問題?拍照後出現錯誤訪問錯誤

+0

請發表您的完整的錯誤message..that將幫助您和別人來... – Nit 2013-03-01 05:23:07

+0

如果你是在多線程環境..而不是使用performSelectorOnMainThread performSelectorInBackground。 – Dee 2013-03-01 07:37:41

+0

thanks.it工作正常。爲什麼它不與performSelectorInBackground一起使用? – user2067403 2013-03-02 04:07:04

回答

0

代替[self dismissModalViewControllerAnimated:YES];

使用[picker dismissModalViewControllerAnimated:YES];

+0

我正在後臺運行整個代碼的方法。是否有原因? – user2067403 2013-03-01 05:59:32

+0

@ user2067403你的意思是你在後臺線程中調用UI方法? – trojanfoe 2013-03-01 07:24:14

+0

yes.i確實在線程中運行完整的代碼 – user2067403 2013-03-01 11:51:09

相關問題