¡@

Home 

2014/10/15 ¤U¤È 10:10:07

iphone Programming Glossary: hostreachable

How to check for an active Internet Connection on iPhone SDK?

http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk

Create a couple instances to check in the interface section of the .h file Reachability internetReachable Reachability hostReachable 5 Add a method in the .h for when the network status updates void checkNetworkStatus NSNotification notice 6 Add #import.. reachabilityForInternetConnection internetReachable startNotifier check if a pathway to a random host exists hostReachable Reachability reachabilityWithHostName @ www.apple.com hostReachable startNotifier now patiently wait for the notification.. check if a pathway to a random host exists hostReachable Reachability reachabilityWithHostName @ www.apple.com hostReachable startNotifier now patiently wait for the notification 8 Set up the method for when the notification gets sent and set whatever..

iOS/iPhone Reachability - How to only check when internet is lost/not reachable using Reachability.m/.h

http://stackoverflow.com/questions/4772173/ios-iphone-reachability-how-to-only-check-when-internet-is-lost-not-reachable

reachabilityForInternetConnection retain internetReachable startNotifier check if a pathway to a random host exists hostReachable Reachability reachabilityWithHostName @ www.google.ca retain hostReachable startNotifier now patiently wait for the notification.. check if a pathway to a random host exists hostReachable Reachability reachabilityWithHostName @ www.google.ca retain hostReachable startNotifier now patiently wait for the notification when calling NSNotificationCenter addObserver selector name object.. via WIFI. break case ReachableViaWWAN NSLog @ The internet is working via WWAN. break NetworkStatus hostStatus hostReachable currentReachabilityStatus switch hostStatus case NotReachable NSLog @ A gateway to the host server is down. break case..