【发布时间】:2011-03-13 12:47:50
【问题描述】:
在这个论坛上已经有很多关于“wait_fences:未能收到回复”的问题,但没有一个建议的解决方案对我有用(尽管它们确实帮助我缓解了它)。
当我的应用程序启动时,我会进行可达性检查,如果我无法访问我正在寻找的主机,我会弹出一个 UIAlertView。最初我什至在设置视图控制器之前就这样做了,但后来我了解到“wait_fences”问题的原因之一是如果您还没有显示视图,则响应程序链没有正确设置 - 所以我将所有内容都移到了 -viewDidAppear 中。基本上,这就是我所拥有的:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// Figure out what the reflections name is, then check to see if it can find it online;
// If it can't, -informUserSiteIsNotReachable is called, below
[self retrieveReflectionByName:self.todaysReflectionName];
[self displayReflectionByName:self.todaysReflectionName];
}
- (void)informUserSiteIsNotReachable
{
SEL messageSelector;
if (NO == [self internetIsReachable]) {
messageSelector = @selector(internetNotAccessible);
} else {
messageSelector = @selector(reflectionsSiteNotAccessible);
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[Strings alertViewTitleWhenSiteIsUnreachable] message:[Strings performSelector:messageSelector] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:NULL];
[alert show];
[alert release];
}
我似乎无法摆脱 wait_fences 问题:有什么建议吗?
【问题讨论】:
-
没有人对我有任何建议,甚至没有建议阅读?我会做任何事情来摆脱这个消息(嗯,几乎任何事情)。
-
嗨 JoBu 1324,你的问题得到任何答案了吗?旋转我的应用程序时,我也面临同样的问题。你能帮我解决这个问题吗?
-
不,我没有;正如我所提到的,我能做的最好的事情是通过将警报移动到 -viewDidAppear 来最小化它导致的等待。如果您有任何发现,请告诉我!
-
你肯定可以解决这个问题,因为我回答如下。您只需要使用一个 Timer 来延迟 AlertView。
标签: iphone uialertview reachability