iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot objective-c objective-c

iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot


I'm pretty sure this is just a bug in iOS 8.0. It's reproducible with the simplest of POC apps that does nothing more than attempt to present a UIImagePickerController like you're doing above. Furthermore, there's no alternative pattern to displaying the image picker/camera, to my knowledge. You can even download Apple's Using UIImagePickerController sample app, run it, and it will generate the same error out of the box.

That said, the functionality still works for me. Other than the warning/error, do you have issues with the functioning of your app?


I was struggling with this issue for several hours, i have read every relevant topic and found out that the error was caused because under the privacy settings of my device, the camera access to my app was blocked!!! I have never denied access to camera and i don't know how it was blocked but that was the problem!


I don't have enough reputation points to comment on @greg's answer above, so will add my observations here. I have a Swift project for both iPad and iPhone. I have a method inside my main view controller (relevant bit below). When I test this on a phone, everything works properly and no warnings are generated. When I run it on an iPad, everything works properly but I see the warning about snapshotting the view. The interesting bit, however, is that when I run on an iPad without using the popover controller, everything works properly with no warning. Unfortunately, Apple mandates that the image picker must be used within a popover on iPad, if the camera is not being used.

    dispatch_async(dispatch_get_main_queue(), {        let imagePicker: UIImagePickerController = UIImagePickerController();        imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum;        imagePicker.mediaTypes = [kUTTypeImage];        imagePicker.allowsEditing = false;        imagePicker.delegate = self;        if(UIDevice.currentDevice().userInterfaceIdiom == .Pad){ // on a tablet, the image picker is supposed to be in a popover            let popRect: CGRect = buttonRect;            let popover: UIPopoverController = UIPopoverController(contentViewController: imagePicker);            popover.presentPopoverFromRect(popRect, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Up, animated: true);        }else{            self.presentViewController(imagePicker, animated: true, completion: nil);        }    });