swift 监听网络状态
来源:互联网 发布:excel表格数据素材 编辑:程序博客网 时间:2024/06/07 10:07
AFNetworkReachabilityManager.sharedManager().startMonitoring()
AFNetworkReachabilityManager.sharedManager().setReachabilityStatusChangeBlock { (status) in
switch status {
case .Unknown:
JLToast.makeText("当前网络未知", duration: 3).show(UIApplication.sharedApplication().keyWindow)
case .NotReachable:
JLToast.makeText("当前网络不可以用,请检查!", duration: 3).show(UIApplication.sharedApplication().keyWindow)
case .ReachableViaWiFi:
break
case .ReachableViaWWAN:
break
}
}
//写你的代码
return true
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
AFNetworkReachabilityManager.sharedManager().stopMonitoring()
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
AFNetworkReachabilityManager.sharedManager().startMonitoring()
}
- swift 监听网络状态
- Swift实时监听网络状态(更新到Swift3)
- swift 监听键盘状态
- swift 监听网络变化
- 监听网络状态
- android监听网络状态
- Android监听网络状态
- Android 监听网络状态
- android监听网络状态
- Android网络状态监听
- 监听网络状态
- 监听网络状态
- ios网络状态监听
- android 网络状态监听
- 监听网络状态
- BroadcastReceiver监听网络状态
- android网络状态监听
- Android监听网络状态
- SQL语句性能优化
- SSM框架整合
- Oracle:查看对象有没有被其他对象引用语句
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 683: illegal multibyte sequence
- px,dp,sp的简单理解
- swift 监听网络状态
- 支付宝 iOS SDK 官方下载页面
- CODEVS 3731寻找道路 (重修版)
- nmap#4有趣功能
- 文章标题
- dede获取上级栏目名称
- Android初学习 - 转载一篇Handler机制总结
- 关于ACM练习第八题的思考和解答
- mt7620 按键驱动