在这个论坛上已经有很多关于“wait_fences: failed to receive reply”的问题,但是没有一个建议的解决方案对我有用(尽管它们确实帮助我减轻了它)。
当我的应用程序启动时,我会进行可达性检查,如果我无法访问我正在寻找的主机,我会弹出一个 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 问题:有什么建议吗?