13 Replies
      Latest reply: Oct 10, 2017 2:50 PM by rapdevpro RSS
      andreasdias9 Level 1 Level 1 (0 points)

        I am working on top of the ARKit Demo App. I created a button that opens up my photo library so that I could select a photo and store it in an UIImage variable. I am getting the error:

         

        PhotoPicker discovery error: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

         

        after I select a photo from the Photo Library on my phone. I think the error occurs at the line, "self.dismiss(animated: false, completion: nil)", where self is the main ViewController.


        I made sure to add the NSPhotoLibraryUsageDescription key in my Info.plist with a description.


        • Re: Error dismissing ImagePickerController
          a4anton Level 1 Level 1 (0 points)

          did you find the solution?

          • Re: Error dismissing ImagePickerController
            YojimboMaster Level 1 Level 1 (0 points)

            The issue seems to be with this small thing....

             

            WRONG

                func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {}

            CORRECT

                func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {}

            • Re: Error dismissing ImagePickerController
              Riadhoq Level 1 Level 1 (0 points)

              I got the same error, I was using the info[UIImagePickerControllerImageURL] then I changed it to info[UIImagePickerControllerOriginalImage] as? UIImage , and it solved the issue for me. Hope it helps.

              • Re: Error dismissing ImagePickerController
                marinly Level 1 Level 1 (0 points)

                Tried all of these suggestions and still get the error in the debug log.  Running Swift 4 XCode 9A235

                 

                What was suggest at various places

                - some people said add @objc

                - some people said add internal

                - some people suggested adding  _ and making sure using Any and not AnyObject

                - some people said to use didFinishPickingImageWithInfo (this returns no image for me)

                - some people said dismsss the picker, others said dismiss self, others said dismiss both

                - some said add the 'Privacy... ' to plist (done)

                - other suggestions here: https://stackoverflow.com/questions/44465904/photopicker-discovery-error-error-domain-pluginkit-code-13

                 

                I DID NOT get this issues in Swift 3 - previous xcode

                But with Swift 4, I tried everying I saw suggested and I still get the following error

                 

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

                 

                The picker works fine and I DO end up selecting an image from photos, but I get this error message on exit, every time...  Any suggestions?

                 

                my method

                 

                   @objc internal func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

                 

                        imagePickerSelected = nil

                 

                        if let editedImage = info["UIImagePickerControllerEditedImage"] as? UIImage {

                            imagePickerSelected = editedImage

                        } else if let originalImage = info["UIImagePickerControllerOriginalImage"] as? UIImage {

                            imagePickerSelected = originalImage

                        }

                 

                        if  imagePickerSelected != nil {

                            handleSelectedImage()   // override in subclass to do somethign with the return image

                        }

                        picker.dismiss(animated: true, completion: nil)   // mess of calling both dismiss to see if it helps - it does not

                        dismiss(animated: true, completion: nil)

                 

                    }

                  • Re: Error dismissing ImagePickerController
                    vale_mac Level 1 Level 1 (0 points)

                    I am getting the same exact error and my implementation is in Objective-C. Definitivilety not an issue related to type casting the info dictionary values returned in the delegate method: in obj-c the values of info dictionary are type casted as id in the method signature:

                     

                    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
                    
                    

                     

                    I did as well take your same course of actions, but I'm still getting the error. Plus I've also added the code to request and handle the authorization status to access user's photo library.

                    I've also tried, as you did, to dismiss the image picker controller directly. No luck with that too.

                    I get the error either an image is selected from the library or not and always on dismissal of the image picker controller.

                     

                    I've also tried to keep a strong reference to the image picker controller, still no luck with that too.

                    • Re: Error dismissing ImagePickerController
                      rapdevpro Level 1 Level 1 (0 points)

                      Marinly,

                       

                      I have followed your exact same journey with the exact same results: no luck at all trying everything you did. I've looked at the StackOverflow posts too, and nothing has worked.  XCode 9.0, iOS 11.  Only additional weird behavior I see is that, when running in the simulator, there is a 10 - 18 second delay after selecting one of the five photos in the simulator's photo roll; I don't see this delay on an actual device.

                       

                      I also tried adding the (I think new) Privacy setting in plist, "Media Library Usage".  No workie.

                       

                      I'll be monitoring this and StackOverlow to see if someone comes up with a solution.