I use UIImagePickerController by default, with allowEditing set YES for shooting. When the user moves and scales the photo, the OS requests access to the "Photo". The application is disabled if the user denies access.
- (void)openCamera { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.editing = YES; imagePickerController.allowsEditing = YES; imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; imagePickerController.delegate = self; [self presentViewController:imagePickerController animated:YES completion:nil]; }
And the UIImagePickerControllerDelegate method looks like
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = info[UIImagePickerControllerEditedImage]; if (!image) { image = info[UIImagePickerControllerOriginalImage]; } self.profileImage = image; [picker dismissViewControllerAnimated:YES completion:nil]; }
Failure Message:
*** This application is not allowed to access Photo data.
I wonder why he should first request access to photos. Any thoughts?
ios ios8 uiimagepickercontroller
Ramsundar shandilya
source share