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

So I know this has been answered a number of times before, but I have yet to come across a solution that works for me.

The odd thing too, is that the first time I present the Camera from a UIPickerController it works fine, exactly as intended. But then if I open it again it shows just a black screen with the Camera controls (“Cancel” button and white take picture button).

  • How can I stop Xamarin from building my app with bitcode enabled?
  • Xamarin: UICollection Image reorder Issue
  • No valid iPhone code signing keys found in keychain
  • ViewController Segue Xamarin
  • ERROR ITMS-90164/90046: Invalid Code Signing Entitlements
  • Are Xamarin iOS apps bloated unreasonably?
  • Any help suppressing this error would be greatly appreciated, or even just some confirmation that this is a bug and I just have to wait for Apple to fix it would be a great help!

    Thanks all 🙂

    (P.S. I’m running on an iPhone 6 Plus using iOS 8.1)

    EDIT: Code (I’m using Xamarin and c#)

    public void ShowPhotoTaker (UIViewController vc)
        {
            UIImagePickerController picker = new UIImagePickerController ();
            picker.SourceType = UIImagePickerControllerSourceType.Camera;
    
            picker.FinishedPickingMedia += (object sender, 
                picker.DismissViewController(true, null);
            };
    
            picker.Canceled += (object sender, EventArgs e) => {
                picker.DismissViewController(true, null);
            };
    
            vc.PresentViewController (picker, true, null);
        }
    

    And this is the exact error I get when calling this method

    Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
    

    2 Solutions Collect From Internet About “iOS8 Snapshotting a view that has not been rendered results in an empty snapshot”

    I have had this error for a while too. I’ve contacted Xamarin Support, and they’ve told me that this is an error with iOS 8 and higher. There’s no solution for this, other than waiting for some bugfix to roll out for iOS development or perhaps Xamarin itself. A workaround might be to set the build SDK to an earlier version and clean + rebuild your application.

    Snapshotting a view that has not been rendered results in an empty snapshot same error.

    This is definitely a bug and you can find this in apple developer forums as well.

    I have tried to avoid this error using lot of other answers on stack overflow but could not fix this issue. However using this I could some how not get this error, i would not call this a fix, But give it a try and let me know if it had fixed the issue.
    Dismiss the view controller using the Grand Central Dispatch async from the main queue fixed the issue for me.

    -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    
    // Code to handle the image data 
    
    dispatch_async(dispatch_get_main_queue(), ^{
        [self dismissViewControllerAnimated:YES completion:nil];
    });
    }
    -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    dispatch_async(dispatch_get_main_queue(), ^{
    [self dismissViewControllerAnimated:YES completion:nil];
    
    });
    
    }