I have read many postings on this website (especially this: iOS 8 Snapshotting a view that has not been rendered results in an empty snapshot) but there is no answer for Swift.
Thought I would ask the crowd here if they have solved this problem or not.
I am using Xcode 6.2, iOS 8.2 on an iPhone 6
My code:
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
if(UIImagePickerController .isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)){
imag = UIImagePickerController()
imag.delegate = self
imag.sourceType = UIImagePickerControllerSourceType.Camera;
imag.allowsEditing = false
imag.mediaTypes = [kUTTypeImage]
imag.showsCameraControls = false
self.presentViewController(imag, animated: true, completion: nil)
imag.cameraDevice = UIImagePickerControllerCameraDevice.Front
imag.takePicture()
}
}
If I change this (self.presentViewController(imag, animated: true, completion: nil)) to (self.presentViewController(imag, animated: YES, completion: nil)), I get and error to switch back to true.