UiImagePicker warning

"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"


I'm getting this warning when I used UIImagePickerController to take photo from camera.And couldn't set image to imageview


Language - swift

os -ios 8

Has anyone found the solution or cause of this?

Here is my code and I've tried switching the order of line 5 to before line 9


@IBAction func takePhoto(sender: UIButton) {
       
        let imagePicker: UIImagePickerController! = UIImagePickerController()
        imagePicker.delegate = self
       
        if (UIImagePickerController.isSourceTypeAvailable(.Camera)) {
            if UIImagePickerController.availableCaptureModesForCameraDevice(.Front) != nil {
                imagePicker.allowsEditing = false
                imagePicker.sourceType = .Camera
                imagePicker.cameraCaptureMode = .Photo
                imagePicker.cameraDevice = .Front
                presentViewController(imagePicker, animated: true, completion: {})
            } else {
                print("Camera not found")
            }
        } else {
            print("Application cannot access the camera.")
        }
    }

I also have this issue on an iPad mini running 9.3.5 but not on various hardware running 10.3

UiImagePicker warning
 
 
Q