2013-03-01 31 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