Fid*_*del 5 memory-leaks uiimagepickercontroller swift3
我已经为这个问题苦苦挣扎了好几个星期了。我到处都看过网上,发现除了这个2个局外人链接之外,没有什么比这个问题更重要的了:
https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues/200
https://issues.apache.org/jira/browse/CB-11784
但是那些没有使用相同的环境,也没有解决问题的实际方法。
这是我启动imagePicker并拍照后使用Xcode 8.3的Instrumentals的屏幕截图:
以下是与imagePicker相关的代码:
//initializer on my class
var imagePicker = UIImagePickerController()
//imagepicker setup on ViewDidLoad()
imagePicker.delegate = self
imagePicker.allowsEditing = false
imagePicker.mediaTypes = [kUTTypeImage as String]
if UIImagePickerController.isSourceTypeAvailable(.camera) {
imagePicker.sourceType = .camera
}
else {
print("Sorry this app only supports camera")
}
//function to start picker when click on button
func startPicker(){
self.present(imagePicker, animated: false, completion: nil)
}
//delegate functions
func imagePickerControllerDidCancel(_ picker: UIImagePickerController)
{
imagePicker.dismiss(animated: false, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
{
//display photo on view
imagePicker.dismiss(animated: false, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
这是IOS上的错误,还是可以消除此内存泄漏?
我只是想指出,从 IOS 12 开始,这个问题仍然存在,我必须使用 AVFoundation 的相机来避免崩溃。使用 AVFoundation 我可以拍摄数百张照片并且没有发生内存泄漏。
| 归档时间: |
|
| 查看次数: |
785 次 |
| 最近记录: |