Reachability实时检测网络连接状况
2013-03-08 11:19
369 查看
//Called by Reachability whenever status changes.
- (void)reachabilityChanged: (NSNotification* )note
{
Reachability* curReach = [note
object];
NSParameterAssert([curReach
isKindOfClass: [Reachability class]]);
if (curReach == internetReach) {
NetworkStatus netStatus = [curReach
currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{
DDLogInfo(@"internet Reachability no internet");
}
break;
default:
{
DDLogInfo(@"internet Reachability has internet begin xmppStart");
[[[_xmppClient
xmppiKnowFramework] xmppReconnect]
manualStart];
}
break;
}
}
}
- (void)networkReachability {
// Observe the kNetworkReachabilityChangedNotification. When that notification is posted, the
// method "reachabilityChanged" will be called.
[[NSNotificationCenter
defaultCenter] addObserver:
self
selector:
@selector(reachabilityChanged:)
name:
kReachabilityChangedNotification
object:
nil];
internetReach = [[Reachability
reachabilityForInternetConnection] retain];
[internetReach
startNotifier];
} http://blog.csdn.net/yuhuangc/article/details/7410452
- (void)reachabilityChanged: (NSNotification* )note
{
Reachability* curReach = [note
object];
NSParameterAssert([curReach
isKindOfClass: [Reachability class]]);
if (curReach == internetReach) {
NetworkStatus netStatus = [curReach
currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{
DDLogInfo(@"internet Reachability no internet");
}
break;
default:
{
DDLogInfo(@"internet Reachability has internet begin xmppStart");
[[[_xmppClient
xmppiKnowFramework] xmppReconnect]
manualStart];
}
break;
}
}
}
- (void)networkReachability {
// Observe the kNetworkReachabilityChangedNotification. When that notification is posted, the
// method "reachabilityChanged" will be called.
[[NSNotificationCenter
defaultCenter] addObserver:
self
selector:
@selector(reachabilityChanged:)
name:
kReachabilityChangedNotification
object:
nil];
internetReach = [[Reachability
reachabilityForInternetConnection] retain];
[internetReach
startNotifier];
} http://blog.csdn.net/yuhuangc/article/details/7410452
相关文章推荐
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- iOS 使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- IOS使用Reachability实时检测网络连接状况
- Android中检测网络连接状况的方法
- [IOS 开发] AFNetworking2.2 setReachabilityStatusChangeBlock检测网络连接状态
- 使用java检测网络连接状况
- iOS下的实际网络连接状态检测:RealReachability
- 检测连接指定主机网络状况
- 实时检测网络状态及是否可以连接Internet
- IOS AFNetworking2.2 setReachabilityStatusChangeBlock检测网络连接状态
- iPhone 网络连接检测(Wifi,3G,Edge),功能有点像Reachability [转]
- 实时检测网络状态及是否可以连接Internet
- 网络连接状态检测:RealReachability