gpt4 book ai didi

objective-c - UIAlertView wait_fences : failed to receive reply: 10004003

转载 作者:行者123 更新时间:2023-11-29 13:21:59 24 4
gpt4 key购买 nike

当我想在没有互联网连接时提醒用户时出现此错误

请帮帮我,这是我的代码:

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
__block UIAlertView *alert = nil;
//---------- Check Connection -------
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// set the blocks
reach.unreachableBlock = ^(Reachability*reach) // not connected
{
//NSLog(@"UNREACHABLE!");
alert =
[[UIAlertView alloc]
initWithTitle: @"No Network Connection!"
message:@"Sorry, we can't currently connect you to the app. Please check your internet connection."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];

[alert show];
//[alert release];

};

reach.reachableBlock = ^(Reachability*reach)
{
//NSLog(@"REACHABLE!");
};

// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];

}

错误是“wait_fences:未能收到回复:10004003”有什么建议么?

最佳答案

我之前遇到过类似的问题。因为我试图在 block 中显示警报 View 。

我将以下行添加到我的 block 而不是 [alert show]; 并且一切正常。

[alertview performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:false];

尝试仅从主线程更新您的UI,否则会导致问题或显示不可预知的结果。

关于objective-c - UIAlertView wait_fences : failed to receive reply: 10004003,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14160807/

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