Chris
Chris

Reputation: 7310

UIImagePicker freezes

I'm able to call the modal view controller for the image picker, pick the image, and crop it, but when I tap 'done' it doesn't do anything, it just hangs with the done button grayed out. There are no errors, but the function is called.

- (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];
}

Upvotes: 1

Views: 342

Answers (1)

Rayfleck
Rayfleck

Reputation: 12106

Replace

 [[picker parentViewController] dismissModalViewControllerAnimated:YES];

with:

 [self dismissModalViewControllerAnimated:YES];

Upvotes: 2

Related Questions