UIImagePicker冻结

我可以调用图像select器的模式视图控制器,select图像,然后裁剪,但是当我点击“完成”时,它不会执行任何操作,它只是在完成button变灰的情况下挂起。 没有错误,但函数被调用。

- (void)viewDidLoad { self.imgPicker = [[UIImagePickerController alloc] init]; self.imgPicker.allowsImageEditing = YES; self.imgPicker.delegate = self; self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { userImage.image = img; uploadButton.hidden = NO; [[picker parentViewController] dismissModalViewControllerAnimated:YES]; NSLog(@"called"); } - (IBAction)getImage:(id)sender { [self presentModalViewController:self.imgPicker animated:YES]; } 

更换

  [[picker parentViewController] dismissModalViewControllerAnimated:YES]; 

有:

  [self dismissModalViewControllerAnimated:YES];