【问题标题】:Access to Photo library not granted on real device在真实设备上未授予对照片库的访问权限
【发布时间】:2016-02-19 00:55:58
【问题描述】:

在我的应用中,用户应该有权访问照片库来选择应该在 ImageView 组件中显示的照片。

我正在使用以下代码:

@IBAction func selectPhotoButtonTapped(sender: AnyObject) {

    picker.allowsEditing = false
    picker.sourceType = .PhotoLibrary
    self.botonEnviar.hidden=false
    presentViewController(picker, animated: true, completion: nil)



}

func imagePickerControllerDidCancel(picker: UIImagePickerController) {
    dismissViewControllerAnimated(true, completion: nil)
}



func imagePickerController(
    picker: UIImagePickerController,
    didFinishPickingMediaWithInfo info: [String : AnyObject])
{
    let chosenImage = info[UIImagePickerControllerOriginalImage] as! UIImage
    myImageView.contentMode = .ScaleAspectFit
    myImageView.image = resizeImage(chosenImage, newWidth: 1000)


    dismissViewControllerAnimated(true, completion: nil)


}

这在模拟器上运行良好,但在真实设备上,应用无法访问设备的照片库。

我需要在应用中包含哪些内容才能请求用户访问照片库的权限? 谢谢。

【问题讨论】:

标签: ios swift


【解决方案1】:

首先,检查您的设备设置>>您的应用>>权限。

【讨论】:

  • 谢谢。已为我的应用检查并为空,未要求任何权限
猜你喜欢
  • 2015-02-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-26
  • 2014-03-06
  • 1970-01-01
相关资源
最近更新 更多