Similar to
PhotoPicker discovery error: Error Domain=PlugInKit Code=13
and also to
https://forums.developer.apple.com/thread/82105
BUT I have t
It is because your app uses photo library (in this case, using UIImagePickerController
) without asking for user permission. As an example, if I want to show the image picker when the add button was tapped:
@IBAction func addButtonTapped(_ sender: UIBarButtonItem) {
checkPermission {
let picker = UIImagePickerController()
picker.sourceType = .photoLibrary
picker.mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary)!
picker.delegate = self
picker.allowsEditing = false
self.present(picker, animated: true, completion: nil)
}
}
func checkPermission(hanler: @escaping () -> Void) {
let photoAuthorizationStatus = PHPhotoLibrary.authorizationStatus()
switch photoAuthorizationStatus {
case .authorized:
// Access is already granted by user
hanler()
case .notDetermined:
PHPhotoLibrary.requestAuthorization { (newStatus) in
if newStatus == PHAuthorizationStatus.authorized {
// Access is granted by user
hanler()
}
}
default:
print("Error: no access to photo album.")
}
}
In addition, need to add this to your plist as well:
NSPhotoLibraryUsageDescription
So that you can add images for your cloth.
which is the message displayed in the permission dialog.