AFHTTPSessionManager *manager=[[AFHTTPSessionManager alloc]init];
//拼接参数
NSMutableDictionary *parameters=[NSMutableDictionary dictionary];
parameters[@"a"]=@"list";
parameters[@"c"]=@"data";
parameters[@"type"]=@"1";
[manager GET:@"http://api.budejie.com/api/api_open.php" parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSLog(@"请求成功--------%@",responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"请求失败--------%@",error);
}];
使用AFHTTPSessionManager发起GET请求
本文介绍如何使用AFHTTPSessionManager发起GET请求,并展示了如何设置请求参数、处理请求的成功与失败回调。通过示例代码,读者可以了解到具体的实现细节。
1万+

被折叠的 条评论
为什么被折叠?



