作者:噯嘅坟墓_996 | 来源:互联网 | 2023-05-27 10:14
我正在使用默认的UIImagePickerController,并将allowsEditing设置为YES来拍摄照片.当用户移动并缩放照片时,操作系统会要求访问"照片".如果用户拒绝访问,应用程序将崩溃.
- (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];
}
和UIImagePickerControllerDelegate方法一样
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *image = info[UIImagePickerControllerEditedImage];
if (!image) {
image = info[UIImagePickerControllerOriginalImage];
}
self.profileImage = image;
[picker dismissViewControllerAnimated:YES completion:nil];
}
崩溃消息:
*** This application is not allowed to access Photo data.
我想知道为什么它应该首先要求访问照片.有什么想法吗?