Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm also using UIImagePickerController and ran into the same issue with a blank screen. I'd like to expand a little on what klaudz mentioned regarding iOS 7 authorization for the camera.</p> <p>Reference: <a href="https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html" rel="noreferrer">https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html</a></p> <p>"Recording audio always requires explicit permission from the user; recording video also requires user permission on devices sold in certain regions."</p> <p>Here is some code fragments you can start with to check to see if you have permission for the camera and request it if your app hadn't previously requested it. If you are denied due to an earlier request, your app may need to put up a notice to the user to go into settings to manually enable access as klaudz pointed out.</p> <p><strong>iOS 7 example</strong></p> <pre><code>NSString *mediaType = AVMediaTypeVideo; // Or AVMediaTypeAudio AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:mediaType]; // This status is normally not visible—the AVCaptureDevice class methods for discovering devices do not return devices the user is restricted from accessing. if(authStatus == AVAuthorizationStatusRestricted){ NSLog(@"Restricted"); } // The user has explicitly denied permission for media capture. else if(authStatus == AVAuthorizationStatusDenied){ NSLog(@"Denied"); } // The user has explicitly granted permission for media capture, or explicit user permission is not necessary for the media type in question. else if(authStatus == AVAuthorizationStatusAuthorized){ NSLog(@"Authorized"); } // Explicit user permission is required for media capture, but the user has not yet granted or denied such permission. else if(authStatus == AVAuthorizationStatusNotDetermined){ [AVCaptureDevice requestAccessForMediaType:mediaType completionHandler:^(BOOL granted) { // Make sure we execute our code on the main thread so we can update the UI immediately. // // See documentation for ABAddressBookRequestAccessWithCompletion where it says // "The completion handler is called on an arbitrary queue." // // Though there is no similar mention for requestAccessForMediaType, it appears it does // the same thing. // dispatch_async(dispatch_get_main_queue(), ^{ if(granted){ // UI updates as needed NSLog(@"Granted access to %@", mediaType); } else { // UI updates as needed NSLog(@"Not granted access to %@", mediaType); } }); }]; } else { NSLog(@"Unknown authorization status"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload