IOS 10 Development Adaptation series permissions crash problem

Source: Internet
Author: User

After upgrading IOS 10, there are still a lot of visual pits, record it and see if it will be a series.

Go straight to the chase.

Today, using a small project to practice, found to call the camera, collapsed. Try to call the album, but also special collapse. Then see the console output the following information:
This app had 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 means that you need to add a key to the Info.plist file NSPhotoLibraryUsageDescription , and then add a description.

Solution Solutions
1. Locate the file in the project info.plist and right-click to Source Code open it
2. Add the following key-value pairs, with photolibrary as an example

<key>NSPhotoLibraryUsageDescription</key><string> this App requires your consent to read the Media Library </string>

Note that key is absolutely not written wrong,

and value is <string></string> you can write it

Visual inspection of all required permission description will be in IOS beta inside crash, do not fear, console will have output, self-added on OK, I also have a few key/value to you

<key>NSCameraUsageDescription</key>    <string>cameraDesciption</string><key> Nscontactsusagedescription</key>    <string>contactsDesciption</string><key> Nsmicrophoneusagedescription</key>    <string>microphoneDesciption</string>

Of course, my preferred approach is to directly
info.plistOr use Property List the form, then click Add, or swipe to the last item to appear with a small plus sign
Input Privacy can quickly locate this permission series, find the permissions you need, modify the following value to

This article references: http://www.jianshu.com/p/c212cde86877

IOS 10 Development Adaptation series permissions crash problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.