7
我使用的默認UIImagePickerController的allowEditing設置爲YES拍照。當用戶移動和縮放照片時,操作系統要求訪問「照片」。 如果用戶拒絕訪問,該應用會崩潰。當用戶在UIImagePickerController中移動和縮放後拒絕對照片的權限時,iOS應用會崩潰
- (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.
我不知道爲什麼它應該要求獲得的照片擺在首位。 有什麼想法?
使用TweetBot應用程序測試過該案例。在那裏也崩潰。似乎是一個操作系統問題。 –
我建議您在出示相機之前檢查「照片」權限,因爲您允許進行需要訪問照片的編輯。 – rmaddy
你罰款它的任何解決方案。 –