4

我已经阅读了该网站上的许多帖子(尤其是:iOS 8 Snapshotting a view that has not been rendering in an empty snapshot),但 Swift 没有答案。

我想我会问这里的人群他们是否解决了这个问题。

我在 iPhone 6 上使用 Xcode 6.2、iOS 8.2

我的代码:

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()
        }
    }

如果我将此(self.presentViewController(imag,animated:true,completion:nil))更改为(self.presentViewController(imag,animated:YES,completion:nil)),我会得到错误以切换回true。

4

1 回答 1

0

我在控制台中收到相同的警告,但其他一切都应该工作。如果没有显示摄像头,请检查设备设置中的摄像头权限。

于 2015-06-11T16:30:29.370 回答