#import <Foundation/Foundation.h>
#import "AFHTTPSessionManager.h"
@interface AFAppDotNetAPIClient : AFHTTPSessionManager
+ (instancetype)sharedClient;
@end
#import "AFAppDotNetAPIClient.h"
static NSString * const AFAppDotNetAPIBaseURLString =@" ";
@implementation AFAppDotNetAPIClient
+ (instancetype)sharedClient {
static AFAppDotNetAPIClient *_sharedClient = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedClient = [[AFAppDotNetAPIClient alloc]initWithBaseURL:[NSURLURLWithString:AFAppDotNetAPIBaseURLString]];
_sharedClient.securityPolicy = [AFSecurityPolicypolicyWithPinningMode:AFSSLPinningModeNone];
[_sharedClient.reachabilityManagersetReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatusstatus) {
switch (status) {
case AFNetworkReachabilityStatusReachableViaWWAN:
//手机自带网络可用(GPRS)
NSLog(@"-------AFNetworkReachabilityStatusReachableViaWWAN------");
break;
case AFNetworkReachabilityStatusReachableViaWiFi:
//WIFI可用
NSLog(@"-------AFNetworkReachabilityStatusReachableViaWiFi------");
break;
case AFNetworkReachabilityStatusNotReachable:
//无网络连接
NSLog(@"-------AFNetworkReachabilityStatusNotReachable------");
break;
default:
break;
}
}];
[_sharedClient.reachabilityManager startMonitoring];
});
return _sharedClient;
}
@end