gpt4 book ai didi

ios - iOS 6 中的 UIAlertView 崩溃

转载 作者:可可西里 更新时间:2023-11-01 04:22:42 25 4
gpt4 key购买 nike

我有这个代码:

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];

问题是这段代码在显示警报之前崩溃了,我已经在较低版本的 iOS 上测试过它并且它可以工作但是在 iOS 6 上它崩溃了。

最佳答案

我找到了答案。我编码:

[alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];

代替

[alert show];

它崩溃是因为进程可能没有在主线程中执行。

来源: https://stackoverflow.com/a/12475858/1179680

关于ios - iOS 6 中的 UIAlertView 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12950887/

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