Saturday, March 18, 2017

Choosing images with UIImagePickerController in Swift


When use UIImagePcikerController to access photo library, an error is hit as below.

This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

This issue is what is found in Ref [2]. Adding the following in Info.plist will resolve the issue

<key>NSPhotoLibraryUsageDescription</key>

<string>Allow the app to pick an image to share with others</string>

References
--------------
1. http://www.codingexplorer.com/choosing-images-with-uiimagepickercontroller-in-swift/
2. http://stackoverflow.com/questions/37925583/uiimagepickercontroller-crashes-app-swift3-xcode8

No comments:

Post a Comment