Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 630 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PhotoPicker discovery error: Error Domain=PlugInKit Code=13

#21
If you have not done so, try [this][1].

>Product > Scheme > Edit Scheme > Environment Variables `OS_ACTIVITY_MODE: disable`

It solves my issue.

[1]:

[To see links please register here]

%20%3E%20Scheme%20%3E%20Edit%20Scheme%20%3E%20On%20your%20Environment%20Variables%20set%20OS_ACTIVITY_MODE
Reply

#22
Tried a few of the combination responses without much success.

Using Swift 4, I found that I needed to make sure the following two items were implemented to ensure that the image was selected and placed into the picker (note that the "[discovery] errors encountered while discovering extensions:

>Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}"

message still displays in the console, but it does not prevent you from adding an image). Maybe this is a message that results in the picker being dismissed?

1) The delegate for the `UIImagePickerController` is `(UIImagePickerControllerDelegate & UINavigationControllerDelegate)?` so need to explicitly add the `UINavigationControllerDelegate` as one of the protocols:

class ViewController:UIViewController, UIImagePickerControllerDelegate,
UINavigationControllerDelegate { .... }.

2) Make sure that the info.plist has the `Privacy - Photo library Usage Description` key and String value set.

Of course, you need to ensure that you create a `UIImagePickerController` and set its delegate equal to `self` in `ViewDidLoad()`:

class ViewController:UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
let imagePickerController = UIImagePickerController()
override func viewDidLoad() {
super.viewDidLoad()
imagePickerController.delegate = self
}
...
}
Reply

#23
Please check by steps as follow:

1. Import Photos
2. Has access to album:


func authorizeToAlbum(completion:@escaping (Bool)->Void) {

if PHPhotoLibrary.authorizationStatus() != .authorized {
NSLog("Will request authorization")
PHPhotoLibrary.requestAuthorization({ (status) in
if status == .authorized {
DispatchQueue.main.async(execute: {
completion(true)
})
} else {
DispatchQueue.main.async(execute: {
completion(false)
})
}
})

} else {
DispatchQueue.main.async(execute: {
completion(true)
})
}
}

3. Present UIImagePickerController

self.authorizeToAlbum { (authorized) in
if authorized == true {
let picker = UIImagePickerController()
picker.delegate = self
picker.allowsEditing = false
picker.sourceType = .photoLibrary

self.present(picker, animated: true, completion: nil)
}
}

4. **The key step, make sure the delegate method is like following strictly**

// MARK: - UIImagePickerControllerDelegate Methods
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
self.pickedImage = pickedImage
if let finalImage = handleImage(originalImage: self.pickedImage!, maskImage: self.maskImage!) {
self.imageView.image = finalImage
}
}

dismiss(animated: true, completion: nil)
}
Reply

#24
*** Missing DELEGATE *** in Swift 3<br><br>
In my case, all settings was correct:<br>
1 - Delegates ( UIImagePickerControllerDelegate,UINavigationControllerDelegate );<br>
2 - Permissions already verified;<br>
3 - Plist already done;<br>
4 - Everything read on this Answers, i did;

But i forgot to implement `pickerview.delegate = self` on `viewDidLoad`
Because i COPY and PASTE from my other viewController and forget that!

I hope it help somebody, review your COPY / PASTE first!!!
Reply

#25
**click on imageView to load image from photo library and show preview on same imageview. on swift 4**



let imagePicker = UIImagePickerController()
@IBOutlet weak var userImage: UIImageView!

override func viewDidLoad() {
super.viewDidLoad()
imagePicker.delegate = self
let tap = UITapGestureRecognizer(target: self, action: #selector(SignUpViewController.click))
userImage.addGestureRecognizer(tap)
userImage.isUserInteractionEnabled = true
}

@objc func click()
{
imagePicker.allowsEditing = false
imagePicker.sourceType = .photoLibrary
present(imagePicker, animated: true, completion: nil)
}


@objc func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let chosenImage = info[UIImagePickerControllerOriginalImage] as? UIImage{
userImage.contentMode = .scaleAspectFit
userImage.image = chosenImage
}
dismiss(animated: true, completion: nil)
}

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
Reply

#26
This might not be the most directly helpful answer - but hopefully it will help! I'm 99% sure that this particular error message isn't actually pointing you to the real problem. I spent hours pulling my hair out over this same exact issue.

1) I had authorization for photos printing to the console when I'd launch my picker, 2) I could navigate and pick a photo easy enough, and 3) when I would return me to my view upon dismissing the picker, my button image wasn't updated with the new photo... and the only hint that I had to the problem was the exact same error message that you are receiving.

Turns out I was hard-coding a placeholder image in ViewWillAppear instead of ViewDidLoad. Every time the picker was dismissing, it was calling ViewWillAppear and replacing my chosen image with my hard coded image. I fixed that issue and sure enough - everything is working fine now... and I'm still seeing that error message every time I return from the picker.

I recommend looking somewhere other than the ImagePicker for your problem and you'll likely find it.
Reply

#27
I found this solution. We got this error due to these two reason which is mentioned below.

1. First we need to call this method in for authorization

Authorization Code

func checkPermission() {
let photoAuthorizationStatus = PHPhotoLibrary.authorizationStatus() switch photoAuthorizationStatus {
case .authorized: print("Access is granted by user")
case .notDetermined: PHPhotoLibrary.requestAuthorization({
(newStatus) in print("status is \(newStatus)") if newStatus == PHAuthorizationStatus.authorized { / do stuff here */ print("success") }
})
case .restricted: / print("User do not have access to photo album.")
case .denied: / print("User has denied the permission.")
}
}





2. Correct way of method Calling of `didFinishPickingMediaWithInfo`

***Wrong:***

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

Right

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

I hope this solution will help you out to resolve this error.

If it works for you don't forget to mark it's as a correct, so this will help to other to find the correct way.
Reply

#28
i found the solution of IMage PickerView.....



@IBOutlet weak var myImageView: UIImageView!

var imagePicker = UIImagePickerController()


@IBAction func selectImage(_ sender: Any) {

let myPickerController = UIImagePickerController()
myPickerController.delegate = self;
myPickerController.sourceType = UIImagePickerControllerSourceType.photoLibrary

self.present(myPickerController, animated: true, completion: nil)

}

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

var selectedImageFromPicker: UIImage?

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


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

selectedImageFromPicker = originalImage as! UIImage


}

dismiss(animated: true, completion: nil)

if var selectedImage = selectedImageFromPicker
{
myImageView.image = selectedImage
}

}

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
picker.dismiss(animated: true, completion: nil)
}
Reply

#29
This solved my error :

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage
addPhotoBtn.setImage(pickedImage, for: .normal)
dismiss(animated: true, completion: nil)


}

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)

}
Reply

#30
I have the same error and I fixed it in this way:

get image object in different way depends on UIImagePickerController allowsEditing is true or false

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

if isImagePickerAllowEditing {
sourceImage = info[UIImagePickerControllerEditedImage] as? UIImage
} else {
sourceImage = info[UIImagePickerControllerOriginalImage] as? UIImage
}

....

}

And of course, ask the permission to access photo library first as above comments.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through