gpt4 book ai didi

ios - UIImagePickerController 相机预览在 ios9 中变黑

转载 作者:行者123 更新时间:2023-11-29 01:38:51 24 4
gpt4 key购买 nike

我正在 Xcode 7 中编写以下代码并在其中运行应用程序:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = `enter code here`(id)self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
[self.navigationController presentViewController:picker animated:YES completion:nil];

但相机预览在 ios9 中变黑,我收到此警告:

My 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

最佳答案

试试这个代码片段:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
picker.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.navigationController presentViewController:picker animated:YES completion:nil];

确保您的设备SETTINGS如下所示:

iPhone 6 device settings

关于ios - UIImagePickerController 相机预览在 ios9 中变黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32651698/

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