Ios 为什么我能';t使用UIImagePickerController访问照片库

Ios 为什么我能';t使用UIImagePickerController访问照片库,ios,Ios,没有错误,但当我在真实手机上测试它时,即使在模拟中,它也只显示一个锁定图像,“此应用程序无法访问您的照片或视频,您可以在隐私设置中启用访问”,但当我转到设置时,我无法在隐私设置中找到我的应用程序。我哪里出错了 override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.row == 0 { if UIImageP

没有错误,但当我在真实手机上测试它时,即使在模拟中,它也只显示一个锁定图像,“此应用程序无法访问您的照片或视频,您可以在隐私设置中启用访问”,但当我转到设置时,我无法在隐私设置中找到我的应用程序。我哪里出错了

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    if indexPath.row == 0 {
        if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary){

            let imagePicker = UIImagePickerController()
            imagePicker.delegate = self
            imagePicker.allowsEditing = false


            let selectedSourceAction = UIAlertController(title: "What source do you want to access?", message: "", preferredStyle: UIAlertControllerStyle.ActionSheet)

            let fromPhotoLibrary = UIAlertAction(title: "Photo Library", style: UIAlertActionStyle.Default, handler: {(action: UIAlertAction!) -> Void in
                imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary

                self.presentViewController(imagePicker, animated: true, completion: nil)
        })
            let fromCamera = UIAlertAction(title: "Camera", style: UIAlertActionStyle.Default, handler: {(action: UIAlertAction!) -> Void in
                imagePicker.sourceType = UIImagePickerControllerSourceType.Camera

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

            let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)

            selectedSourceAction.addAction(fromPhotoLibrary)
            selectedSourceAction.addAction(fromCamera)
            selectedSourceAction.addAction(cancelAction)

            self.presentViewController(selectedSourceAction, animated: true, completion: nil)
        }


    }

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {


    imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage
    imageView.contentMode = UIViewContentMode.ScaleAspectFit
    imageView.clipsToBounds = true

    dismissViewControllerAnimated(true, completion: nil)
}

当应用程序的Info.plist文件包含一个带有空字符串值的键:“CFBundleDisplayName”时,IOS 9上可能会出现此类错误。

转到设置-->隐私-->照片-->在您的应用程序上启用照片app@Maddy不,当我第一次打开应用程序时,它没有提醒我是否要拒绝或接受它访问我的照片,我找不到刚刚安装在隐私应用程序中的应用程序list@Maddy但是我创建了另一个项目并输入了相同的代码,它工作得很好,我想在我自己的项目上可能会出错谢谢,这解决了我两天几乎发疯后的问题。非常奇怪的是,试图显示UIImagePickerController只是默默地失败了,没有显示错误是什么。我使用了CropViewController库我在模拟器中弹出,但在设备上没有。有什么帮助吗?