【问题标题】:send POST request with xml body and recieve xml response with AFNetworking 3.x发送带有 xml 正文的 POST 请求并使用 AFNetworking 3.x 接收 xml 响应
【发布时间】:2016-11-30 11:20:34
【问题描述】:

您好,我正在尝试使用 xml 正文编写 AFNetworking 3.x 发布请求并从服务器接收 xml(因为服务器接受 xml 输入和输出 xml)。我用 JSON 成功了,但是 xml 有问题。

如何修改这些模板以发送 xml 正文和接收 xml 响应。 我们应该使用什么库来解析 xml 响应?非常感谢任何帮助。谢谢

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {     
    if (error) {  
        NSLog(@"Error: %@", error);
    } else {     
        NSLog(@"%@ %@", response, responseObject);  
    }   
}];
[dataTask resume];

【问题讨论】:

    标签: xml serialization afnetworking


    【解决方案1】:

    这是您正在寻找的答案的链接。

    Try this

    H@ppy c0de !!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2011-06-07
      • 1970-01-01
      • 1970-01-01
      • 2017-09-24
      • 2014-07-13
      相关资源
      最近更新 更多