gpt4 book ai didi

ios - 错误 : Attempt to present
转载 作者:塔克拉玛干 更新时间:2023-11-02 09:47:37 28 4
gpt4 key购买 nike

大家好,感谢阅读。我正在制作一个应用程序,您可以在其中拍照并从相机胶卷中检索照片并将其显示在 View 中。问题是,当我尝试使用调出相机胶卷的按钮时,出现如上标题中的错误“演示正在进行中”。

如果我注释掉代码 [self presentViewController:imagePicker animated:YES completion:NULL];在 viewdidappear 方法中,我可以调出相机胶卷...我不知道如何正确关闭它,我试过 [imagePicker dismissViewControllerAnimated:YES completion:NULL];但无济于事。

这是我的代码!感谢您查看。

-(IBAction)chooseExisting:(id)sender {

[imagePicker dismissViewControllerAnimated:YES completion:NULL];
imagePicker2 = [[UIImagePickerController alloc] init];
imagePicker2.delegate = self;
[imagePicker2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:imagePicker2 animated:YES completion:NULL];

-(void)viewDidAppear:(BOOL)animated{
while (chooseExistingInt <1) {

overlayView.hidden = false;
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:imagePicker animated:YES completion:NULL];
imagePicker.showsCameraControls = NO;
imagePicker.cameraOverlayView = overlayView;
chooseExistingInt ++;
}
}

固定的(也许)我改变了:

[imagePicker dismissViewControllerAnimated:YES completion:NULL];

[imagePicker dismissViewControllerAnimated:NO completion:NULL];

将动画更改为“NO”。 WTF:s

最佳答案

将您要执行的代码放在此处

[[NSOperationQueue mainQueue] addOperationWithBlock:^{
//your code
}];

关于ios - 错误 : Attempt to present <UIImagePickerController: on <ViewController: while a presentation is in progress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14622783/

28 4 0

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