7.10 网络请求遇到的问题

+(AFHTTPSessionManager *)getAFManager{

[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;

AFHTTPSessionManager *manager = manager = [AFHTTPSessionManager manager];

//    manager.requestSerializer = [AFHTTPRequestSerializer serializer];//设置请求参数为字节流(这个按后台要求配置)

//    manager.responseSerializer = [AFJSONResponseSerializer serializer];//设置返回数据为json

manager.requestSerializer=[AFJSONRequestSerializer serializer];//申明请求的数据是json类型

manager.responseSerializer = [AFJSONResponseSerializer serializer];//申明返回的结果是json类型

manager.requestSerializer.stringEncoding = NSUTF8StringEncoding;

manager.requestSerializer.timeoutInterval=10;

manager.responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"application/json",

@"text/html",

@"text/json",

@"text/plain",

@"text/javascript",

@"text/xml",

@"image/*"]];

return manager;

}

你可能感兴趣的:(7.10 网络请求遇到的问题)