图片库没有打开。相机工作正常,但从照片库获取的图像却没有显示空白屏幕。昨天很好,但今天不开。请帮助任何帮助将学徒。我是Ios系统的新成员
@IBAction func uploadImageClick (sender : UIButton){
let optionMenu = UIAlertController(title: nil, message: "Choose Option", preferredStyle: .ActionSheet)
let deleteAction = UIAlertAction(title: "Choose From Gallery", style: .Default, handler: {
(alert: UIAlertAction!) -> Void in
self.picker.allowsEditing = true
self.picker.sourceType = .PhotoLibrary
self.presentViewController(self.picker, animated: true, completion: nil)
})
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: {
(alert: UIAlertAction!) -> Void in
})
optionMenu.addAction(deleteAction)
optionMenu.addAction(cancelAction)
self.presentViewController(optionMenu, animated: true, completion: nil)
}
extension NewsViewController : UIImagePickerControllerDelegate,UINavigationControllerDelegate{
func imagePickerController(
picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : AnyObject]){
let chosenImage = info[UIImagePickerControllerOriginalImage] as! UIImage
dismissViewControllerAnimated(true, completion: nil)
}
}发布于 2016-10-25 15:35:08
您需要在plist中添加下面的内容
密钥是隐私-照片库使用说明 类型是字符串 价值是使用照片(这里你想要的任何东西)

https://stackoverflow.com/questions/40241959
复制相似问题