本文介绍了reachabilityWithHostName示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了
我的问题是如果www.apple.com变得不活跃突然..这段代码会提醒我吗?
或者只是我的连接失败?

i read the https://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.htmlmy Question is if the www.apple.com is become not active Suddenly..this code will alert me?or just if my connection fail's?

推荐答案

这是绝对正确的。

它将触发 kReachabilityChangedNotification 通知,告知您新的可达性状态。

It will fire off a kReachabilityChangedNotification notification that tells you the new reachability state.

你得到的新的可达性状态如下:

You get the new reachability state something like this :

- (void)reachabilityChanged:(NSNotification *)notification {
    Reachability *reachability = notification.object;

    if (NotReachable == reachability.currentReachabilityStatus)
        NSLog(@"No longer reachable");
}

这篇关于reachabilityWithHostName示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 04:35