Determine whether you have the permission to access the camera, album, and location

Source: Internet
Author: User

1. Determine whether the user has the permission to access the album.

# Import ALAuthorizationStatus author = [ALAssetsLibraryauthorizationStatus]; if (author = privileged | author = kclthorizationstatusdenied) {// No permission} typedef enum {authorization = 0, // The user has not yet made a greeting for choosing this app kclthorizationstatusrestricted, // This app is not authorized to access photo data. It may be that the parent has the permission to kCLAuthorizationStatusDenied. // The user has explicitly denied that the photo data application has accessed kCLAuthorizationStatusAuthorized. // The user has authorized the application to access the photo data} CLAuthorizationStatus;


2. Determine whether the user has the permission to access the camera

You can access the camera before iOS7, And you can access the camera after iOS7.

# Import AVAuthorizationStatus authStatus = [authorization: AVMediaTypeVideo]; if (authStatus = AVAuthorizationStatusRestricted | authStatus = AVAuthorizationStatusDenied) {// No permission}

3. Determine whether to enable the positioning service

[CLLocationManagerlocationServicesEnabled] // checks whether the positioning service of the entire iOS system is enabled to detect whether the positioning service of the current application is enabled. You need to use the following method to detect-(void) locationManager :( CLLocationManager *) manager didFailWithError :( NSError *) error


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.