gpt4 book ai didi

ios - 应用程序无法访问您的照片或视频 iOS 9

转载 作者:行者123 更新时间:2023-12-02 11:19:09 25 4
gpt4 key购买 nike

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

enter image description here

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

@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)

}

最佳答案

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

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

关于ios - 应用程序无法访问您的照片或视频 iOS 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32923458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com