I am having trouble with UIImagePickerController. I want to be able to open the photo library and select an image, when I do I get the following error
[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}`
I assumed this was probably a permissions error since I mistakenly hadn't added a row in my plist for photo access so I added the entry for photo library access:
Privacy - Photo library Usage Description
with the type string
and value set to photo use
and still I get no prompt for permission to access photos when I try and access them.
To minimise anything else causing problems I have made a new project it simply has a single view controller and the above entry in the plist, below shows the only code in this class
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate
{
var mImagePicker:UIImagePickerController?
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func tapped(_ sender: Any)
{
// Pick an image from the photo library
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary)
{
mImagePicker = UIImagePickerController()
mImagePicker!.delegate = self
mImagePicker!.sourceType = .photoLibrary;
mImagePicker!.allowsEditing = false
self.present(mImagePicker!, animated: true, completion: nil)
}
}
}
when I tap the button I see no prompt for permission, the photo library simply appears and when I select a photo I get the error shown above? is there something I'm missing here?
Im running iOS 12 on an iPhone X and Xcode 10.0 on the latest version of the Mojave beta
You don't actually need permission if you're just accessing photos using UIImagePickerController
from iOS 11. Permission is required when you use AVFoundation
or Photos
framework.
In my experience, iOS logs those errors that we can ignore sometimes, and I think you can ignore the error messages this time.