AFNetworking and No Internet Connection scenario

后端 未结 5 1536
误落风尘
误落风尘 2020-12-07 17:21

I use AFNetworking in my app for every request (like login, get data from url, etc).

Take this for example: an user click on the login button and there\

5条回答
  •  广开言路
    2020-12-07 17:50

    With AFNetworking these are the steps that one has to follow in order to take advantage of setReachabilityStatusChangeBlock: after adding the AFNetworing classes -

    1. Add SystemConfiguration.framework to your project
    2. In pch file add #import
    3. Assuming that you have a subclass of AFHTTPClient in this subclass add below lines of code in init function -
    [self setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
            NSLog(@"changed %d", status);
            //your code here
        }];
    

提交回复
热议问题