1:创建NSMutableURLRequest
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
URLString:(NSString *)URLString
parameters:(id)parameters
error:(NSError *__autoreleasing *)error
{
//---增加断言当一下参数为空的时候停止程序并打印错误日志
NSParameterAssert(method);
NSParameterAssert(URLString);
NSURL *url = [NSURL URLWithString:URLString];
//如果根据传入的参数创建出来的url为空则停止程序打印错误日志
NSParameterAssert(url);
//通过以上断言,成功通过之后根据正确的url创建mutableRequest对象
NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url];
//设置mutableRequest的请求方式(GET、POST、HEAD、DELETE、PUT等)
mutableRequest.HTTPMethod = method;
/*
设置mutableRequest的属性 AFHTTPRequestSerializerObservedKeyPaths()函数创建参数数组
①allowsCellularAccess 是否允许使用蜂窝网络
②cachePolicy 缓存策略
1:NSURLRequestUseProtocolCachePolicy (默认的缓存策略,如果本