[翻译] PBJNetworkObserver 网络监控

+关注继续查看

PBJNetworkObserver 网络监控

https://github.com/piemonte/PBJNetworkObserver

Introduction

'PBJNetworkObserver' is an iOS component for detecting changes in network reachability state as well as connection type. For example, it can determine when an IP is being routed through a Wireless Wide Area Network (WWAN) interface such as 3G or LTE.

'PBJNetworkObserver'是一个iOS组件,用来监测网络状态的改变或者网络连接类型的改变.例如,他可以检测一个IP地址能否通过无线网络连接到广域网.

Mobile devices are frequently moving through connectivity challenged environments made up of various network interfaces. This component enables apps to easily monitor these network changes and allow opportunities to refresh, cache, or even provide user interface feedback when they occur.

Some common uses include auto-refresh, logic that can be triggered for a view if the device upgrades from an EDGE network to a WiFi access point allowing more or higher quality data to be quickly loaded.

Observers are notified when a network is no longer reachable, the network becomes reachable, and when the network interface type changes.

If you have questions, github issues is a great means to start a discussion, this allows others to benefit and chime in on the project too.

Usage

#import "PBJNetworkObserver.h"

@interface MyClass () <PBJNetworkObserverProtocol>

// add observer on init or viewDidAppear

// remove observer on dealloc or on viewDidDisappear
[[PBJNetworkObserver sharedNetworkObserver] removeNetworkReachableObserver:self];

- (void)networkObserverReachabilityDidChange:(PBJNetworkObserver *)networkObserver
{
// network status changed, these properties can also be queried at any time
BOOL isNetworkReachable = [networkObserver isNetworkReachable];
BOOL isCellularConnection = [networkObserver isCellularConnection];
NSLog(@"network status changed reachable (%d),  cellular (%d)", isNetworkReachable, isCellularConnection);
}



向往前一样，学习牛腩新闻发布系统的视频，敲代码，打开数据库，出现一个框框，详细内容如下：                 数据库连接不上，所有的工作都要歇班，捣鼓了会儿，简单总结一下解决该问题的方法。
1224 0
Qt之处理QNetworkAccessManager网络连接超时

3933 0

819 0
Linux网络进程监控工具nethogs
Linux网络监控工具nethogs 标签： 监控工具linux 2015-12-17 22:06 448人阅读 评论(0) 收藏 举报  分类： linux（40）  版权声明：本文为博主原创文章，未经博主允许不得转载。
964 0

1417 0
+关注
711

0

《2021云上架构与运维峰会演讲合集》

《零基础CSS入门教程》

《零基础HTML入门教程》