代码库> 其他> Reachability实时监测网络连接状态
Reachability实时监测网络连接状态
关注
上传者:颜小风 分类:其他(Others)
查看次数:6244 下载次数:377
上传时间:2014-01-09 大小:41 B
采用了arc 和新的block方式

实时监测使用方法


// Allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// Tell the reachability that we DON'T want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;

// Here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(reachabilityChanged:)
                                             name:kReachabilityChangedNotification
                                           object:nil];

[reach startNotifier];



收藏
我来说两句
发表评论
您还没有登录!请登录注册
所有评论(0


综合评论
提示
sina weixin mail 回到顶部