gpt4 book ai didi

ios - UIImagePicker 给出运行时错误

转载 作者:行者123 更新时间:2023-11-30 13:55:01 25 4
gpt4 key购买 nike

这是我的代码。我已经实现了 UIImagePicker,但在运行时它没有向我显示用于访问模拟器中图库的权限的对话框

@IBOutlet var uploadImage: UIImageView!

@IBAction func upldImageBtn(sender: UIButton) {
imagePicker.allowsEditing = false
imagePicker.sourceType = .PhotoLibrary

presentViewController(imagePicker, animated: true, completion: nil)
}

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage{
uploadImage.contentMode = .ScaleAspectFill
uploadImage.image = pickedImage
uploadImage.layer.borderWidth = 0.5
uploadImage.layer.masksToBounds = false
uploadImage.layer.cornerRadius = uploadImage.frame.size.height/2
uploadImage.clipsToBounds = true
}

dismissViewControllerAnimated(true, completion: nil)
}

最佳答案

尝试重置模拟器。

该选项位于菜单 -> iOS 模拟器 -> 重置内容和设置...

如果这没有帮助,请发布您所看到的运行时错误的详细信息。

关于ios - UIImagePicker 给出运行时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33737392/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com