IOS7 Camera Privacy judgment

Source: Internet
Author: User

Transferred from: http://borissun.iteye.com/blog/1992303

The iOS7 IP5 's privacy settings have more cameras in it (IP4 no iOS7).
If your app's camera is turned off in privacy, it will be a black screen. So you have to decide if this is happening.
The first reaction must be to go to Uiimagepickercontroller to find the corresponding method, and then the following 2 methods seem to satisfy this requirement:

Objective-c Code
    1. These two all don't work!!!
    2. [Uiimagepickercontroller Issourcetypeavailable:uiimagepickercontrollersourcetypecamera];
    3. [Uiimagepickercontroller Iscameradeviceavailable:uiimagepickercontrollercameradevicerear];



But neither of these works! Always return yes ...

Also checked, found that even need to use avfoundation. So you need to give avfoundation to link and then call:

Objective-c Code
    1. BOOL iscameravalid = YES;
    2. Judge IOS7 macro, did not write a, the bottom method is iOS7 new,7 The following call will be error
    3. if (Isios7andlater)
    4. {
    5. Avauthorizationstatus authstatus = [Avcapturedevice authorizationstatusformediatype:avmediatypevideo];
    6. if (authstatus! = avauthorizationstatusauthorized)
    7. {
    8. Iscameravalid = NO;
    9. }
    10. }
    11. }

IOS7 Camera Privacy judgment

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.