I am also using UIImagePickerController and faced the same blank screen issue. I would like to talk a little about what Cloudts said about authorizing iOS 7 for the camera.
Link: https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html
"Recording audio always requires explicit permission from the user; video recording also requires the permission of the user on devices sold in certain regions."
Here are some snippets of code that you can start to check if you have permission for the camera and request it if your application has not requested it before. If you are denied due to an earlier request, your application may need to notify the user that they enter the settings to manually allow access, as Cloudes pointed out.
IOS 7 example
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"); }
Scott Carter Sep 29 '13 at 2:55 2013-09-29 02:55
source share