AFNetworking POST方法调用 [英] AFNetworking POST method call

查看:94
本文介绍了AFNetworking POST方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 AFNetworking 的新手。我如何执行以下成功和失败的块

I am new to AFNetworking. How can i execute the success and failure blocks of the following

NSMutableDictionary *rus = [[NSMutableDictionary alloc] init];
[rus setValue:@"1211" forKey:@"id"];
[rus setValue:@"33" forKey:@"man"];
    [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:@"http://mysite.co/service.php" rus];

执行上述代码段后如何显示成功或失败。

How to show the success or failure after executing the above code fragment.

推荐答案

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager POST:@"http://mysite.co/service.php" parameters:rus success:^(AFHTTPRequestOperation *operation, id responseObject) {
    // Code for success
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    // Code for failure
}];

github的AFNetworking文档

github's AFNetworking document

https://github.com/AFNetworking/AFNetworking

这篇关于AFNetworking POST方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆