Does IOS Reachability determine whether the requested server times out?

Source: Internet
Author: User

When developing Web and other network applications, you must confirm the network environment, connection conditions, and other information. If they are not processed, they will not pass Apple's review.

Apple's routine Reachability describes how to obtain/detect the network status.

1. To use Reachability in your program, you only need to copy the Reachability. h and Reachability. m in this routine to your project.

2. Then add SystemConfiguration. framework to the project.

 

My Version is: Version: 2.2

I added a global -- ReachabilityAutoChecker for Apple's routine.

. H

*

 

. M file

+ ( ReachabilityAutoChecker *staticChecker = (!===- ()reachabilityChanged:(NSNotification** curReach = [note ==

 

I added a Category -- Reachability (AutoChecker) for Apple's routine)

. H file:

+ ()startCheckWithReachability:(Reachability *+

 

. M file:

+ ()startCheckWithReachability:(Reachability **checker ===+*checker = (!=(networkStatus ==(networkStatus ==== kShouldPrintReachabilityFlags                

 

Call method:

AppDelegate. m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *    Reachability *pReachability = [Reachability reachabilityWithHostName:=    self.viewController = [[ViewController alloc] initWithNibName:=

 

ViewController. m

- (IBAction)upInside_checkNetStatus:((!*alert = [[UIAlertView alloc] initWithTitle:                                                       

 

Run-Time reminder: # error "this class needs to be compiled in a non-arc environment. Please add the-fno-objc-arc flag"

The normal network NSLog is as follows:

14:15:53. 084 PRJ_reachability [8153: 11303] Reachability Flag Status:-R ------- networkStatusForFlags

14:15:54. 265 PRJ_reachability [8153: 11303] WIFI

14:15:54. 266 PRJ_reachability [8153: 11303] NetworkStatus 1 connectionRequired 0

 

PRJ_reachability.zip example: http://ishare.iask.sina.com.cn/f/37441462.html

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.