应用无法访问您的照片或视频iOS 9 [英] App does not have access to your photos or videos iOS 9

查看:267
本文介绍了应用无法访问您的照片或视频iOS 9的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用UIImagePicker访问我的照片库以选择照片时,该应用程序有时会向我显示黑屏,有时会显示一个屏幕,说明我必须授予我的应用访问照片的权限。但是,当我进入设置 - >隐私 - >照片时,那里没有应用程序,应用程序无法在设置中看到。我读到我必须在Info.plist中添加两个值,但它们也没有用。有没有人运行相同的错误?我正在使用xcode 7,swift 2.0和iOS 9

When I access my Photo Library with an UIImagePicker to choose a photo, the app shows me sometimes a black screen and sometimes a screen that says that I have to give permissions to my app to access the photos. But when I go to Settings -> Privacy -> Photos, there’s no app there and the app is nowhere to be seen in Settings. I read that I must add two values to my Info.plist but they didn’t worked either. Have anyone run with the same error? I’m working with xcode 7, swift 2.0 and iOS 9

这是我提示用户进行相机访问的地方

This is where i prompt for user for Camera access

@IBAction func cameraButtonPressed(sender: UIButton) {

    let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)

    let cancelAction = UIAlertAction(title: "Cancel", style: .Default) { (UIAlertAction) -> Void in
        self.dismissViewControllerAnimated(true, completion: nil)
    }

    let cameraAction = UIAlertAction(title: "Take Photo", style: .Default) { (UIAlertAction) -> Void in
        if UIImagePickerController.availableCaptureModesForCameraDevice(.Rear) != nil {
            self.imagePicker.allowsEditing = false
            self.imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
            self.imagePicker.cameraCaptureMode = .Photo
            self.presentViewController(self.imagePicker, animated: true, completion: nil)
        } else {
            self.noCamera()
        }
    }

    let photoLibraryAction = UIAlertAction(title: "Photo Library", style: .Default) { (UIAlertAction) -> Void in
        self.imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        self.presentViewController(self.imagePicker, animated: true, completion: nil)
    }

    actionSheet.addAction(photoLibraryAction)
    actionSheet.addAction(cameraAction)
    actionSheet.addAction(cancelAction)

    self.presentViewController(actionSheet, animated: true, completion: nil)

}


推荐答案

此问题出现在iOS 9中当您的应用程序Info.plist文件包含一个键:CFBundleDisplayName,其中包含空字符串值。

This issue appear in iOS 9 when your application Info.plist file contains a key: "CFBundleDisplayName" with empty string value.

您可以在那里输入您的应用程序名称,它应该有效。

You can enter your app name there and it should work.

这篇关于应用无法访问您的照片或视频iOS 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆