0

When I choose an image via the UIImagePickerController, I get the following output in xCode:

[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

This is my code:

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    let image = info[UIImagePickerControllerOriginalImage] as! UIImage
    imagePicked = image
    
    dismiss(animated: true, completion: nil)
    performSegue(withIdentifier: "showImage", sender: self)
}

The ViewController class is declared as it should be:

class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

let imagePickerController = UIImagePickerController()
var imagePicked = UIImage()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    imagePickerController.delegate = self

}

I use a button to open the ImagePicker:

@IBAction func chooseImageBtn(_ sender: Any) {
    imagePickerController.sourceType = .photoLibrary
    self.present(imagePickerController, animated: true, completion: nil)
    
}

When I start the App in the simulator, I can click on the button, and choose an image but then the picker gets closed and this message is shown in Xcode:

2018-05-01 16:50:01.214450+0200 Awesome Name[57575:12752181] [MC] Reading from private effective user settings.

2018-05-01 16:50:03.740711+0200 Awesome Name[57575:12752241] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

I already did some research but nothing worked. The delegate of the ImagePicker is set to self, and I also tried adding @objc before func imagePickerController(_ picker: but that did not solve the problem.

What else can I try to display the selected image?

Community
  • 1
  • 1
Fabian
  • 541
  • 9
  • 30
  • Possible duplicate of [PhotoPicker discovery error: Error Domain=PlugInKit Code=13](https://stackoverflow.com/questions/44465904/photopicker-discovery-error-error-domain-pluginkit-code-13) – Kamran May 01 '18 at 15:47
  • did you request permissions for Photo library with `PHPhotoLibrary.requestAuthorization` ? – Kamran May 01 '18 at 15:48
  • @Kamran I have added the `Privacy - Photo Library Usage Description` key with value to my info.plist – Fabian May 01 '18 at 15:50
  • Yes, but you also have to invoke authorization before accessing it. You can check here how you can do it https://stackoverflow.com/questions/44465904/ – Kamran May 01 '18 at 15:51
  • I implemented the requestAuthorization method and it now asks for access to the photos. After clicking ok, the ImagePicker opens again and it still results into the same output than in my question and nothing happens – Fabian May 01 '18 at 16:03
  • I added an image view to the current ViewController and retried it. This works, but I still get the same Message shown. – Fabian May 01 '18 at 18:05

1 Answers1

1

Try removing the performeSegue function, if you really need to use it just add it on the completion of the dismiss function .