PhotoLibrary没有打开

时间:2016-10-25 13:55:50

标签: ios swift uiimagepickercontroller

图片库未打开。相机工作正常但图像来自照片库没有让他们显示空白屏幕。昨天工作正常,但今天不开放。请帮助任何帮助将被apprciated。我是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)
    }
}

1 个答案:

答案 0 :(得分:1)

您需要在plist中添加以下内容

  

关键是隐私 - 照片库使用说明

     

Type is String

     

价值是使用照片(无论你想在这里给出什么)

.plist image