Hi
I’m trying to use UIImagePickerController to pick an image but i’m getting the following output :
[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 “query cancelled” UserInfo={NSLocalizedDescription=query cancelled}
Code :
PHPhotoLibrary.requestAuthorization(new PHPhotoLibrary.Block_requestAuthorization() {
@Override
public void call_requestAuthorization(@NInt long code) {
if(code == PHAuthorizationStatus.Authorized){
UIImagePickerController imagePickerController = UIImagePickerController.alloc().init();
imagePickerController.setAllowsEditing(true);
imagePickerController.setSourceType(UIImagePickerControllerSourceType.PhotoLibrary);
imagePickerController.setEditingAnimated(true , true);
imagePickerController.setDelegate(new UIImagePickerControllerDelegate() {
@Override
public void imagePickerControllerDidFinishPickingMediaWithInfo(UIImagePickerController picker, NSDictionary<String, ?> info) {
String filePath = info.valueForKey("UIImagePickerControllerImageURL").toString();
filePath = filePath.substring(8);
//UIImagePickerControllerReferenceURL
//UIImagePickerControllerImageURL
File file = new File(filePath);
Foundation.NSLog("selected file path = '" + filePath + "' size =" + file.length());
picker.dismissViewControllerAnimatedCompletion(true,null);
}
@Override
public void imagePickerControllerDidCancel(UIImagePickerController picker) {
picker.dismissViewControllerAnimatedCompletion(true,null);
}
});
UIViewController controller = UIApplication.sharedApplication().delegate().window().rootViewController();
controller.presentViewControllerAnimatedCompletion(imagePickerController , true , null);
}
}
});
Info.plist :
<key>NSPhotoLibraryUsageDescription</key>
<string>You can select photos to attach to reports.</string>
This shows the image picker, but after i select an image, the output mentioned above occurs.