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
- These two all don't work!!!
- [Uiimagepickercontroller Issourcetypeavailable:uiimagepickercontrollersourcetypecamera];
- [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
- BOOL iscameravalid = YES;
- Judge IOS7 macro, did not write a, the bottom method is iOS7 new,7 The following call will be error
- if (Isios7andlater)
- {
- Avauthorizationstatus authstatus = [Avcapturedevice authorizationstatusformediatype:avmediatypevideo];
- if (authstatus! = avauthorizationstatusauthorized)
- {
- Iscameravalid = NO;
- }
- }
- }
IOS7 Camera Privacy judgment