退出时的 Picker 错误消息(在发现扩展时遇到:Error Domain=PlugInKit Code=13)使用 Swift 4 - Xcode 9 [英] Picker Error Message on Exit (encountered while discovering extensions: Error Domain=PlugInKit Code=13) With Swift 4 - Xcode 9
问题描述
类似于
PhotoPicker 发现错误:Error Domain=PlugInKit Code=13一个>
还有
https://forums.developer.apple.com/thread/82105
但是我已经尝试了所有这些建议,但在调试日志中仍然出现错误.运行 Swift 4 XCode 9A235
BUT I have tried all of these suggestions and still get an error in the debug log. Running Swift 4 XCode 9A235
各个地方的建议是......
What was suggest at the various places was ...
- 有人说加@objc
- 有人说添加内部
- 有些人建议添加 _ 并确保使用 Any 而不是任何对象
- 有些人说使用 didFinishPickingImageWithInfo(这会返回没有我的图像)
- 有些人说解雇选择器,其他人说解雇自己,其他人说解雇两个
- 有人说将隐私..."添加到 plist(完成)
- 添加了导入照片
- 预先调用强制 PHPhotoLibrary.requestAuthorization() {(status) -> Void in ...
我在 Swift 3 - 以前的 xcode 中没有遇到这个问题.但是使用 Swift 4,我尝试了所有我看到的建议,但仍然出现以下错误
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] 发现扩展时遇到的错误: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 picker exit (cancel or select), every time...
任何建议如何停止错误消息?除了其他两个链接中提供的内容列表(上面总结)
Any suggestions how to stop the error message? Other than the list of things offered at the other two links (summarized above)
我的方法
@objc internal func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
imageSelected = nil
if let editedImage = info["UIImagePickerControllerEditedImage"] as? UIImage {
imageSelected = editedImage
} else if let originalImage = info["UIImagePickerControllerOriginalImage"] as? UIImage {
imageSelected = originalImage
}
if imageSelected != nil {
handleSelectedImage() // override in subclass to do something with the returned 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)
}
推荐答案
- 将隐私..."添加到 plist
- 从 Xcode 菜单打开:Product > Scheme > Edit Scheme >在您的环境变量中设置 OS_ACTIVITY_MODE 的值设置为禁用
见mc-system-group-container-and-mc-reading-from-public-effective-user-settings-err
工作对我来说很好
如果它可以帮助我的代码(使用 xcode 9)
if it's can help below my code (working with xcode 9)
if libraryAuthorization == .authorized {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.photoLibrary
imagePicker.allowsEditing = false
imagePicker.view.tag = button.tag
self.present(imagePicker, animated: true, completion: nil)
}
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let pickerImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
photoContainer.addImageToButton(pickerImage, buttonTag: picker.view.tag)
dismiss(animated: true)
}
}
这篇关于退出时的 Picker 错误消息(在发现扩展时遇到:Error Domain=PlugInKit Code=13)使用 Swift 4 - Xcode 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!