我遇到一个尝试加载大图像时UIImagePickerController崩溃的问题。
这是我的代码:
import UIKit
class ViewController: UIViewController {
let imagePicker = UIImagePickerController()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
//These are the methods of selecting from camera roll directly
@IBAction func loadImageButtonTapped(_ sender: UIButton) {
imagePicker.allowsEditing = true
imagePicker.sourceType = .savedPhotosAlbum
present(imagePicker, animated: false, completion: nil)
}
}
这是我正在使用的图像,导致UIImagePicker崩溃:
https://www.dropbox.com/s/ykfflbo3es814wb/Circles.PNG?dl=0
要重现该问题,请打开ImagePicker,然后选择大图并放大一点。单击“使用”时,您应该会在XCode控制台中看到UIImagePicker崩溃。
注意:如果您不捏一点,UIImagePicker似乎不会崩溃。
其他人遇到过这个问题吗?
以下是发生错误时XCode在控制台中报告的内容:
2020-01-31 13:21:45.015647-0600 Large Image Test[9899:5765569] [lifecycle ] [u 2FCDF773-5F10-419C-84D2-1D8832227BE8:m (null)] [com.apple.mobileslideshow.photo-picker(1.0)] Connection to plugin interrupted while in use.
2020-01-31 13:21:45.016058-0600 Large Image Test[9899:5746381] viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
2020-01-31 13:21:45.016305-0600 Large Image Test[9899:5746381] [Generic] -[PUPhotoPickerHostViewController viewServiceDidTerminateWithError:] Error Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}