IOS10 use, detect, and direct the user to open the camera album and other permissions

Source: Internet
Author: User

  1. <!--Albums--
  2. <key>NSPhotoLibraryUsageDescription</key>
  3. <string>app need your consent in order to access the album </string>
  4. <!--camera--
  5. <key>NSCameraUsageDescription</key>
  6. <string>app requires your consent to access the camera </string>
  7. <!--Microphones--
  8. <key>NSMicrophoneUsageDescription</key>
  9. <string>app need your consent to access the microphone </string>
  10. <!--location--
  11. <key>NSLocationUsageDescription</key>
  12. <string>app need your consent to access the location </string>
  13. <!--access to location during use--
  14. <key>NSLocationWhenInUseUsageDescription</key>
  15. <string>app requires your consent in order to access the location during use </string>
  16. <!--always access location-
  17. <key>NSLocationAlwaysUsageDescription</key>
  18. <string>app requires your consent in order to always access the location </string>
  19. <!--calendar--
  20. <key>NSCalendarsUsageDescription</key>
  21. <string>app need your consent in order to access the calendar </string>
  22. <!--reminders--
  23. <key>NSRemindersUsageDescription</key>
  24. <string>app need your consent in order to access reminders </string>
  25. <!--sports and fitness--
  26. <key>NSMotionUsageDescription</key> <string>app need your consent to access sports and fitness </string>
  27. <!--Health Updates-
  28. <key>NSHealthUpdateUsageDescription</key>
  29. <string>app need your consent to access health updates </string>
  30. <!--health Sharing--
  31. <key>NSHealthShareUsageDescription</key>
  32. <string>app need your consent in order to access health sharing </string>
  33. <!--Bluetooth--
  34. <key>NSBluetoothPeripheralUsageDescription</key>
  35. <string>app need your consent to access Bluetooth </string>
  36. <!--Media Archive--
  37. <key>NSAppleMusicUsageDescription</key> <string>app requires your consent in order to access the media database </string>

Info.plist the string string that directly duplicates value by adding key one by one is the prompt text can be filled according to your own needs

#import <AVFoundation/AVCaptureDevice.h>

#import <AVFoundation/AVMediaFormat.h>

#import <AssetsLibrary/AssetsLibrary.h>

#import <CoreLocation/CoreLocation.h>

Camera Permissions

Avauthorizationstatus authstatus = [Avcapturedeviceauthorizationstatusformediatype:avmediatypevideo];

if (Authstatus ==avauthorizationstatusrestricted | | This application does not have permission to access the photo data. may be Parental control permissions

Authstatus ==avauthorizationstatusdenied)//user has explicitly denied application access to this photo data

{

No permission to boot to open

Nsurl *url = [nsurlurlwithstring:uiapplicationopensettingsurlstring];

if ([[Uiapplicationsharedapplication]canopenurl:url]) {

[[Uiapplicationsharedapplication]openurl:url];

}

}

Album Permissions

Alauthorizationstatus author = [Alassetslibraryauthorizationstatus];

if (Author ==kclauthorizationstatusrestricted | | author ==kclauthorizationstatusdenied) {

No permission to boot to open

Nsurl *url = [Nsurl urlwithstring:uiapplicationopensettingsurlstring];

if ([[[UIApplication sharedapplication] Canopenurl:url]) {

[[UIApplication sharedapplication] openurl:url];

}

}

IOS10 use, detect, and direct the user to open the camera album and other permissions

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.