I am using XCode 8 and testing with iOS 10.2 Beta.
I have added the Photos, PhotosUI and MobileCoreServices frameworks to project.
Very simple code:
In iOS10, Before you access privacy-sensitive data like Camera, Contacts, and so on, you must ask for the authorization, or your app will crash when you access them.Then Xcode will log like:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an
NSContactsUsageDescriptionkey with a string value explaining to the user how the app uses this data.
How to deal with this?
Open the file in your project named info.plist, right click it, opening as Source Code, paste this code below to it. Or you can open info.plist as Property List by default, click the add button, Xcode will give you the suggest completions while typing Privacy - with the help of keyboard ⬆️ and ⬇️.
Remember to write your description why you ask for this authorization, between and , or your app will be rejected by apple:
- 热议问题