When,I am capturing image from camera then it is giving error on console in ios7.I tried firstly without adding Thread.sleep(3000) in code but that was also not working.
complete error: 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.
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 ();
}
}
To fix this problem in iOS 7, this is what solved my same error.
When I present the UIImagePickerController
which in my case is called imagePickerController
Do not use nil or NULL. Instead, I used the below code and the error no longer appears when opening the camera.
[self presentViewController:imagePickerController animated:YES completion:^{....}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With