Crashes on iOS 10

I spent the last week watching Apple WWDC videos, and after downloading Xcode 8 I was testing several of my libraries and applications.

While testing the WPMediaPicker library I found that the sample app was crashing every time I opened the picker. After some investing on the code I found that the app was crashing the moment I was trying to use the PHPhotoLibrary class.

After some looking around in the documentation I found out this:

Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses the user’s photo library, must statically declare the intent to do so. Include the NSPhotoLibraryUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If your app attempts to access the user’s photo library without a corresponding purpose string, your app exits.

Before iOS 9 if you tried to access the Photo Library without providing this key you will simple get a default warning but now it simple crashes the app.

And this isn’t limited to the Photo Library, this is now standard behaviour to all the libraries that need to have an UsageDescription key on the Info.plist file.

Here is a small compilation:

  • NSAppleMusicUsageDescription

  • NSBluetoothPeripheralUsageDescription

  • NSCalendarsUsageDescription

  • NSCameraUsageDescription

  • NSContactsUsageDescription

  • NSHealthShareUsageDescription

  • NSHomeKitUsageDescription

  • NSLocationAlwaysUsageDescription

  • NSLocationWhenInUseUsageDescription

  • NSMicrophoneUsageDescription

  • NSMotionUsageDescription

  • NSPhotoLibraryUsageDescription

You can find the full list here, just search for UsageDescription on the page.

If you still are not using these keys is time to start to update your applications and use this opportunity to provide a good text for your requests for permissions from  your app users.






Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: