iOS 10 error [access] when using UIImagePickerController

后端 未结 5 905
野趣味
野趣味 2020-11-28 20:03

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:

5条回答
  •  借酒劲吻你
    2020-11-28 20:24

    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 NSContactsUsageDescription key 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:

    
         
     
    热议问题