gpt4 book ai didi

swift 错误 : Snapshotting a view that has not been rendered results in an empty snapshot

转载 作者:搜寻专家 更新时间:2023-10-31 21:48:44 27 4
gpt4 key购买 nike

我已经阅读了该网站上的许多帖子(尤其是:iOS 8 Snapshotting a view that has not been rendered results 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 .

最佳答案

我在 console 中收到相同的警告,但其他一切都应该有效。如果未显示相机,请检查设备设置中的相机权限。

关于 swift 错误 : Snapshotting a view that has not been rendered results in an empty snapshot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29307786/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com