Uiimagepickercontroller Error: Snapshotting a View That Has Not Been Rendered Results in an Empty Snapshot in iOS 7

UIImagePickerController error: Snapshotting a view that has not been rendered results in an empty snapshot in iOS 7

The problem in iOS7 has to do with transitions. It seems that if a previous transition didn't complete and you launch a new one, iOS7 messes the views, where iOS6 seems to manage it correctly.

You should initialize your Camera in your UIViewController, only after the view has Loaded and with a timeout:

- (void)viewDidAppear:(BOOL)animated 
{
[super viewDidAppear:animated];
//show camera...
if (!hasLoadedCamera)
[self performSelector:@selector(showcamera) withObject:nil afterDelay:0.3];
}

and here is the initialization code

- (void)showcamera {
imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[imagePicker setAllowsEditing:YES];

[self presentModalViewController:imagePicker animated:YES];
}

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

Self Solution Working for me like charm :-) hope its helpful for all

DispatchQueue.global(qos: .userInitiated).async
{
self.present(self.imagePicker, animated: true, completion: nil)

}


Related Topics



Leave a reply



Submit