我正在尝试显示或上传UIImage,但出现此错误。
“发现扩展名时遇到错误:错误Domain = PlugInKit代码= 13”查询已取消“ UserInfo = {NSLocalizedDescription =查询已取消}”
import UIKit
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
// linked labels and UiButtons
@IBOutlet weak var ifix: UILabel!
@IBOutlet weak var UIImage: UIImageView!
let someImageView: UIImageView = {
let theImageView = UIImageView()
theImageView.translatesAutoresizingMaskIntoConstraints = false // call this property so the image is added to your view
return theImageView
}()
@IBAction func UploadImage(_ sender: UIButton) {
let myPickerController = UIImagePickerController()
myPickerController.delegate = self;
myPickerController.sourceType = UIImagePickerController.SourceType.photoLibrary
self.present(myPickerController, animated: true, completion: nil)
}
@objc func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any])
{
let image_data = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
let imageData:Data = image_data!.pngData()!
_ = imageData.base64EncodedString()
self.dismiss(animated: true, completion: nil)
}
@IBAction func UIShuffle(_ sender: UIButton) {
}
@IBAction func UIReset(_ sender: UIButton) {
}
override func viewDidLoad() {
super.viewDidLoad()
// additional setup after loading the view, typically from a nib.
view.addSubview(someImageView) //This add it the view controller without constraints
someImageViewConstraints() //This function is outside the viewDidLoad function that controls the constraints
}
// `.isActive = true` after every constraint
func someImageViewConstraints() {
someImageView.widthAnchor.constraint(equalToConstant: 180).isActive = true
someImageView.heightAnchor.constraint(equalToConstant: 180).isActive = true
someImageView.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
someImageView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 28).isActive = true
}
}
答案 0 :(得分:5)
此消息无害。该消息来自操作系统,并且与操作系统有关,需要密切注意与您的应用程序所做的事情相关的所有新发现的扩展。显示打开文件对话框时,我经常在macOS上看到它。在浏览文件时,操作系统正在检查是否需要加载任何与文件相关的扩展名才能向您显示内容。当用户按下“确定”或“取消”时,它将停止搜索扩展名并将该消息发送到控制台。我收集到的iOS可能正在做类似的事情,可能与共享或其他与用户文件有关的活动有关。该消息并不表示您的应用程序有错误。