当我使用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)