With the help of this method, we have improved our reachability check logic when using VPN. Check the VPN status of your network - (BOOL)isVPNOn Get current WWAN type (optional) WWANAccessType accessType = Ĭurrent WWAN type might be used to improve your app's user experience(e.g, set different network request timeout interval for different WWAN type). Codes just like below: GLobalRealReachability.hostForPing = suggest you use two hosts: one your own(if you have one available for pinging), one public Just like the example below.įor more details about the "doublecheck" feature, you can go deep into the codes. If you do not set this, our default host is: You may set your own host any time you like. Please make sure the host you set here is available for pinging. Set your own host for Ping (optional) Note that now we introduced the new feature "doublecheck" to make the status more reliable in 1.2.0! Once the reachabilityWithBlock was called, the "currentReachabilityStatus" will be refreshed synchronously. Query currentStatus ReachabilityStatus status = You can install it with the following command: And we use FSM(finite state machine) to control all of the network status to confirm that only status change will be sent to application.ĬocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like RealReachability in your projects. We introduce ping module for us to check the real network status, together with SCNetworkReachability API. Now RealReachability can do this for you~ The called "reachability" we already know can only tell us the local connection status.These tools currently we know are all supported by the SCNetworkReachability API. "Note that reachability does not guarantee that the data packet will actually be received by the host." Such as the famous repository Reachability.īUT we really need a tool for us to get the reachability, not the local connection!Īpple doc tells us something about SCNetworkReachability API: Why RealReachability?Īs we know, we already have reachability framework for us to choose. We need to observe the REAL reachability of network for iOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |