My var:
@IBOutlet weak var imageView: UIImageView!
Take photo function:
func takePhoto(){
let picker = UIImagePickerController()
picker.delegate = self
picker.sourceType = .Camera
presentViewController(picker, animated: true, completion: nil)
}
Error message:
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
Any ideas?
I have had the same problem - I have two options once I have called the VC - From Photos or Selfie - and when I select Selfie i.e. camera Xcode prints that message but not ion I select Photos - so my guess is its a bug in the camera app. It has never crashed my app so I ignore it Code:
@IBAction func openCameraButton(sender: AnyObject) {
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) == true {
camera = true
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.allowsEditing = false
self.presentViewController(imagePicker, animated: true, completion: nil)
}else{
noCamera()
}
}
Make sure you have:
super.viewDidLoad()
in your viewDidLoad func.
put your self.presentViewController
or your self.navigationController?.showViewController
inside dispatch_async(dispatch_get_main_queue()) {
dispatch_async(dispatch_get_main_queue()) {
self.presentViewController(imagePicker, animated: true, completion: nil)
}
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