My imagePickerController didFinishPickingMediaWithInfo newer get called <p>I try to write an App that needs a screen where you can take multible photos. I have used a code example from <a href="http://makeapppie.com/2015/11/04/how-to-make-xib-based-custom-uiimagepickercontroller-cameras-in-swift/" rel="nofollow">http://makeapppie.com/2015/11/04/how-to-make-xib-based-custom-uiimagepickercontroller-cameras-in-swift/</a>.</p> <p>It seems to be working OK, but my imagePickerController didFinishPickingMediaWithInfo newer get called. I am getting an error message from Xcode "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." It sounds to me like this could be the problem, and I have googled it, but havn't gotten any wiser. A lot of people write it's an Apple bug and I havn't found anybody offering a solution. </p> <p>So do anybody know if it is the Xcode error that is my problem, and in that case have a solution for that or have I written something wrong in my code:</p> <pre><code>import UIKit class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, CustomOverlayDelegate { var picker = UIImagePickerController() @IBAction func shootPhoto(sender: AnyObject) { if UIImagePickerController.availableCaptureModesForCameraDevice(.Rear) != nil { picker = UIImagePickerController() //make a clean controller picker.allowsEditing = false picker.sourceType = UIImagePickerControllerSourceType.Camera picker.cameraCaptureMode = .Photo picker.showsCameraControls = false //customView stuff let customViewController = CustomOverlayViewController( nibName:"CustomOverlayViewController", bundle: nil ) let customView:CustomOverlayView = customViewController.view as! CustomOverlayView customView.frame = self.picker.view.frame customView.cameraLabel.text = "Hello Cute Camera" customView.delegate = self //presentation of the camera picker.modalPresentationStyle = .FullScreen presentViewController(picker, animated: true,completion: { self.picker.cameraOverlayView = customView }) } else { //no camera found -- alert the user. let alertVC = UIAlertController( title: "No Camera", message: "Sorry, this device has no camera", preferredStyle: .Alert) let okAction = UIAlertAction( title: "OK", style:.Default, handler: nil) alertVC.addAction(okAction) presentViewController( alertVC, animated: true, completion: nil) } } func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) { print("didFinishPickingMediaWithInfo") let chosenImage = info[UIImagePickerControllerOriginalImage] as! UIImage //get the image from info UIImageWriteToSavedPhotosAlbum(chosenImage, self,nil, nil) //save to the photo library } //What to do if the image picker cancels. func imagePickerControllerDidCancel(picker: UIImagePickerController) { dismissViewControllerAnimated(true, completion: nil) } //MARK: Custom View Delegates func didCancel(overlayView:CustomOverlayView) { picker.dismissViewControllerAnimated(true, completion: nil) print("dismissed!!") } func didShoot(overlayView:CustomOverlayView) { picker.takePicture() overlayView.cameraLabel.text = "Shot Photo" print("Shot Photo") } func weAreDone(overlayView: CustomOverlayView) { picker.dismissViewControllerAnimated(true, completion: nil) print("We are done!") } } </code></pre>