A snapshot of a snapshot that was not displayed leads to empty snapshots in xamarin.ios7

When I take the image from the camera, it gives an error on the console in ios7.I tried first without adding Thread.sleep (3000) to the code, but this also does not work.

full error: A snapshot of a snapshot that was not displayed results in an empty snapshot. Make sure your view has been viewed at least once before the snapshot or snapshot after screen updates.

the code:

public override void ViewDidLoad () { base.ViewDidLoad (); // Perform any additional setup after loading the view, typically from a nib. PictureFromCameraButton.TouchUpInside += PictureFromCameraButton_Click; } private void PictureFromCameraButton_Click (object sender, EventArgs e) { try { Thread.Sleep (4000); ImagePickerController.SetSourceType(UIImagePickerControllerSourceType.Camera); this.PresentViewController (ImagePickerController, true, null); } catch (NotSupportedException exception) { //Logging Exception in Flurry FA.Flurry.LogError(exception.GetType().Name,exception.Message, new NSError(NSError.CocoaErrorDomain,3584)); BeginInvokeOnMainThread (() => { UIAlertView ErrorAlert = new UIAlertView ("Device unsupported", "Your device does not support this feature", new UIAlertViewDelegate (), "OK"); ErrorAlert.Show (); }); } catch (Exception ex) { //Logging Exception in Flurry FA.Flurry.LogError(ex.GetType().Name,ex.Message, new NSError(NSError.CocoaErrorDomain,3584)); this.ShowErrorInProcessingAlertView (); } } 
+7
source share
3 answers

To fix this issue in iOS 7, this is what resolved my same error.

When I present a UIImagePickerController which in my case is called imagePickerController

Do not use nil or NULL . Instead, I used the code below, and when I open the camera, the error no longer appears.

 [self presentViewController:imagePickerController animated:YES completion:^{....}]; 
+3
source share

This is a bit of a hack, but sometimes you need something initialized during the life cycle for reasons of interaction or something else. So I just sent it in 0.1 seconds to the view in which it sits, and everything seems to be in order. Looking more at it.

  double delayInSeconds = 0.1; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ // Show camera view controller. [self presentViewController:imagePickerController animated:YES completion:nil]; }); 

Hope this helps until someone finds a much better solution.

0
source share

A snapshot of a snapshot that has not been rendered results in an error with a blank snapshot.

This is definitely a mistake, and you can find it on the Apple Developer Forums.

I tried to avoid this error using many other stack overflow answers, but could not fix this problem. However, using this, I might somehow not get this error, I would not call it a fix, but try and let me know if it fixed the problem. Disable view manager using asynchronous Grand Central Dispatch mode from main queue fixed the problem 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]; }); } 
-one
source share

All Articles