gpt4 book ai didi

objective-c - iOS 8 对尚未渲染的 View 进行快照会导致快照为空

转载 作者:IT老高 更新时间:2023-10-28 12:14:33 25 4
gpt4 key购买 nike

在 iOS 8 中,我在从相机捕捉图像时遇到问题,直到现在我将此代码用于

UIImagePickerController *controller=[[UIImagePickerController alloc] init];
controller.videoQuality=UIImagePickerControllerQualityTypeMedium;
controller.delegate=(id)self;
controller.sourceType=UIImagePickerControllerSourceTypeCamera;
[self presentViewController:controller animated:YES completion:nil];

但在 iOS 8 中我得到了这个:

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.

我尝试了This Post 提供的解决方案与

@property (strong,nonatomic)UIImagePickerController *controller;

_controller=[[UIImagePickerController alloc] init];
_controller.videoQuality=UIImagePickerControllerQualityTypeMedium;
_controller.delegate=(id)self;
_controller.sourceType=UIImagePickerControllerSourceTypeCamera;
_[self presentViewController:controller animated:YES completion:nil];

还有这个

...
controller.modalPresentationStyle=UIModalPresentationFullScreen;
or
controller.modalPresentationStyle=UIModalPresentationCurrentContext;
...

还有这个

double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self presentViewController:controller animated:YES completion:nil];
});

还有这个

[self presentViewController:controller animated:YES completion:NULL];

还有这个

[self presentViewController:controller animated:YES completion:^{

}];

有什么想法吗?

最佳答案

我很确定这只是 iOS 8.0 中的一个错误。它可以用最简单的 POC 应用程序重现,这些应用程序只不过是尝试呈现一个 UIImagePickerController 就像你在上面做的那样。此外,据我所知,没有其他模式可以显示图像选择器/相机。你甚至可以下载苹果的Using UIImagePickerController sample app ,运行它,它会立即生成相同的错误。

也就是说,该功能仍然适用于我。除了警告/错误之外,您的应用的功能是否存在问题?

关于objective-c - iOS 8 对尚未渲染的 View 进行快照会导致快照为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25884801/

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