Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c UIAlertView wait_fences:未能接收回复:10004003_Objective C_Ios_Xcode_Uialertview_Reachability - Fatal编程技术网

Objective c UIAlertView wait_fences:未能接收回复:10004003

Objective c UIAlertView wait_fences:未能接收回复:10004003,objective-c,ios,xcode,uialertview,reachability,Objective C,Ios,Xcode,Uialertview,Reachability,当我想提醒用户没有internet连接时,会出现此错误 请帮助我,这是我的代码: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; __block UIAlertView *alert = nil; //---------- Check Connection ------- // allocate a reachability object Reachability* reach = [Reac

当我想提醒用户没有internet连接时,会出现此错误

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

- (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”
有什么建议吗

我以前也遇到过类似的问题。因为我试图在块中显示alertview

我将以下行添加到我的块中,而不是
[alert show]一切正常

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

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

我以前也遇到过类似问题。因为我试图在块中显示alertview

我将以下行添加到我的块中,而不是
[alert show]一切正常

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

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

也许这个线程可以帮助你,我以前见过这个线程,但不幸的是它没有帮助,我的视图中没有任何文本。也许这个线程可以帮助你,我以前见过这个线程,但不幸的是,它没有帮助,我的视图中没有任何文本。@user1789976:很高兴:)谢谢你的评论:)@user1789976:很高兴:)谢谢你的评论:)