我已經設置以下選項,同時使用iPad的圖像。問題是委託人似乎永遠不會被調用。我已經放置了斷點,但它們從未激活過。IOS 10 UIImagePickerController委託沒有被調用
.H
@interface HomeViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
.M
- (IBAction)loadImage:(id)sender {
self.imagePickerController = [[UIImagePickerController alloc] init];
self.imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePickerController.allowsEditing = NO;
self.imagePickerController.delegate = self;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
}
// This method is called when an image has been chosen from the library or taken from the camera.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//You can retrieve the actual UIImage
UIImage *image = [info valueForKey:UIImagePickerControllerOriginalImage];
//Or you can get the image url from AssetsLibrary
NSURL *path = [info valueForKey:UIImagePickerControllerReferenceURL];
[picker dismissViewControllerAnimated:YES completion:nil];
}
任何人都可以看到這個問題?
感謝
看到這一次http://stackoverflow.com/questions/38236723/ios-10-error-access-private-when-using-uiimagepickercontroller –
我沒有複製和粘貼你的代碼,你寫在新的示例項目中我創建,但它的作品。我沒有描述過的一件事就是info.plist隱私照片庫的使用。 – boraseoksoon
嗨,檢查了info.plist,並且隱私設置已經存在。真的很奇怪,因爲我似乎無法找到問題。 – ORStudios