4

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.

Community
  • 1
  • 1
dennis
  • 143
  • 1
  • 12
  • I got this same problem via iOS 8.3/Xcode 6.3. – Frederick C. Lee Apr 29 '15 at 19:15
  • I've submitted the bug report: 20750257 about this. – Frederick C. Lee Apr 29 '15 at 19:43
  • I also got this error with Xcode7 and Swift 2. Has anyone been able to fix this error? I read through the threads that were linked to this discussion with no success. Camera permission are set and the camera does come up and take the photo. Will this error, cause an app to not be approved for the App Store? – ChallengerGuy Jan 26 '16 at 17:46

1 Answers1

0

I'm getting the same warning in console , but everything else should work. if the camera is not shown up , check camera permission in device setting.

Chen Xiaofeng
  • 496
  • 3
  • 8