小编use*_*922的帖子

如何使用AFNetworking 2.0发布数据?

我需要通过POST以可变数据发送我的数据.

我是这样做的:

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
NSDictionary *params = @{@"email" : email, @"password" : pass };
[manager POST:URLString parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"JSON: %@", responseObject);
} failure:
 ^(AFHTTPRequestOperation *operation, NSError *error) {
     NSLog(@"Error: %@", error); }];
Run Code Online (Sandbox Code Playgroud)

并有:

JSON: {
Data = "<null>";
Message = "unexpected end of JSON input";
Result = fail;
}
Run Code Online (Sandbox Code Playgroud)

我知道这个方法

  - (AFHTTPRequestOperation *)POST:(NSString *)URLString
                  parameters:(NSDictionary *)parameters
   constructingBodyWithBlock:(void (^)(id <AFMultipartFormData>))block
                     success:(void (^)(NSURLSessionDataTask *, id))success
                     failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;
Run Code Online (Sandbox Code Playgroud)

但是如何将可变数据中的字典发送到Web服务器?

networking post web-services ios afnetworking-2

3
推荐指数
1
解决办法
8469
查看次数

标签 统计

afnetworking-2 ×1

ios ×1

networking ×1

post ×1

web-services ×1