标签:
AFHTTPRequestOperationManager 核心代码
AFNetworking 2.x
1
2
3
4
5
6
|
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; [manager GET:@ "请求的url" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@ "成功" ); } failure:^(AFHTTPRequestOperation *operation, NSError*error) { NSLog(@ "失败" ); }]; |
AFNetworking 3.0
1
2
3
4
5
6
|
AFHTTPSessionManager *session = [AFHTTPSessionManager manager]; [session GET:@ "请求的url" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) { NSLog(@ "成功" ); } failure:^(NSURLSessionDataTask *task, NSError *error) { NSLog(@ "失败" ); }]; |
标签:
原文地址:http://www.cnblogs.com/happyEveryData/p/5549620.html