2

In my app, the user should have access to Photo Library to select a photo that should be shown in an ImageView component.

I am using following code to do it:

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


}

That works fine on the simulator, but on a real device, the app doesn't have access to the device's Photo Library.

What do I need to include in the app to ask the user for permission to access the Photo Library? Thank you.

mvasco
  • 4,965
  • 7
  • 59
  • 120
  • Answer found here: http://stackoverflow.com/questions/32768012/app-does-not-have-access-to-your-photos-or-videos-ios-9 – mvasco Feb 19 '16 at 20:16

1 Answers1

0

Fisrt of all, Check in your device settings >> Your App >> Permission.

Rahul Patel
  • 534
  • 4
  • 17