<span style="font-family:FangSong_GB2312;font-size:18px;"> /*
AFNetworking更新到3.0之后,有些API被废弃掉,但仅仅对于我们日常使用来说变化不大
之前Opration.responseData也没有了
*/
简单的例子如下:
/*AFHTTPRequestOprationManager 被AFHTTPSessinManger代替*/
AFHTTPSessionManager*manager = [AFHTTPSessionManagermanager];
/*以下参数没有变化
manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
NSDictionary *parameters = @{@"location":@"西安"};
*/
[manager GET:KURLStringparameters:nilsuccess:^(NSURLSessionDataTask*task, id responseObject) {
NSLog(@"%@",responseObject);//Opration被NSURLSessionDataTask代替,responseObject没变化
} failure:^(NSURLSessionDataTask* _Nonnull task, NSError * _Nonnull error) {
if (error) {
NSLog(@"%@",error);
}
}];</span>
08-14
08-14