IPhone NetworkChecking whether the code is available for simple implementation is the content to be introduced in this article, basically based on the Code implementation results. Let's look at the content,
InIPhoneDuring development, you can use the following code to check whether the Network is available for applications requiring Internet connection. You can search for "Reachability" in development help to obtain the Reachability.
- - (void) reachabilityChanged: (NSNotification* )note
- {
- Reachability* curReach = [note object];
- NSParameterAssert([curReach isKindOfClass: [Reachability class]]);
- if(NotReachable == [curReach currentReachabilityStatus])
- {
- // can be changed to Alert here.
- DEBUG_OUTPUT(@"%@",@"Network not available!");
- }
- }
-
- - (void)applicationDidFinishLaunching:(UIApplication *)application
- {
- [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:)
- name: kReachabilityChangedNotification object: nil];
- internetReach = [[Reachability reachabilityForInternetConnection] retain];
- [internetReach startNotifer];
- [window addSubview:navigationController.view];
- [window makeKeyAndVisible];
- }
Summary:IPhone NetworkCheck whether code-based implementation is available. I hope this article will help you!
From: http://www.cnblogs.com/MobileDevelop/archive/2010/07/17/1779774.html