尝试使用 AFNetworkings ReachabilityStatusChanged 但得到
“HTTPCLIENT 没有可见的@interface 声明选择器 setReachabilityStatusChangeBlock”
但是 HttpClient 有这个功能。有谁知道为什么会这样?
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@"http://stat-api.herokuapp.com/"]];
[client setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status){
NSLog(@"%d", status);
}];
/// 更新 ///////////
这是我的 .pch 文件
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "NSDate+Helper.h"
#import "NSEntityDescription+RKAdditions.h"
#import "UIAlertView+MKBlockAdditions.h"
#import "UIActionSheet+MKBlockAdditions.h"
#import "MKBlockAdditions.h"
#import "NSObject+MKBlockAdditions.h"
#import "NSString+Extra.h"
#import "UIView+Additions.h"
#import "ObjectiveSugar.h"
#import "NSNotificationCenter+UniqueNotif.h"
#import "STUIColor+Custom.h"
#import "NSObject+STNSObjectAdditions.h"
#import "UIView+Gradientcy.h"
#import "NSString+USStateMap.h"
#import "STUITextField.h"
#import "UIImage+UIImageCrop.h"
#import "UIBorderLabel.h"
#import <SystemConfiguration/SystemConfiguration.h>
#endif