当我使用UIImagePicker访问我的照片库来选择照片时,该应用程序有时会向我显示黑屏,有时会显示一个屏幕,说我必须授予我的应用访问照片的权限.但是,当我进入设置 - >隐私 - >照片时,那里没有应用程序,应用程序无法在"设置"中看到.我读到我必须在我的Info.plist中添加两个值,但它们也没有用.有没有人运行相同的错误?我正在使用xcode 7,swift 2.0和iOS 9
这是我提示用户进行相机访问的地方
@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 = …Run Code Online (Sandbox Code Playgroud) 我正在iOS模拟器上工作,我面临着请求权限的问题.
我的应用程序工作正常,它可以访问照片库,相机和位置服务.但在安装新的XCode(8.1)后,我在模拟器上运行应用程序,不允许应用程序使用照片库或相机或位置服务.
我尝试以编程方式请求权限,但它没有显示权限请求对话框,并且即使我添加了隐私说明和捆绑显示名称,也始终返回拒绝状态.