在成功回调中访问响应数据 [英] Access Response Data in Success callback
本文介绍了在成功回调中访问响应数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法使用对象管理器访问请求的成功块中的响应数据?
Is there any way to access the response data in the success block for a request using the object manager?
[objectManager postObject:[User class] path:@"/users" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSLog(@"success");
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"failure");
}];
似乎应该有某种方法可以使用映射或操作来获取这些信息,例如 NSData 或其他东西.
It seems like there should be some way to use the mapping or operation to get this information as maybe NSData or something.
推荐答案
您可以从 RKObjectRequestOperation *operation 获取此信息
You can get this info from the RKObjectRequestOperation *operation
operation.HTTPRequestOperation.response
operation.HTTPRequestOperation.responseData
operation.HTTPRequestOperation.responseString
这篇关于在成功回调中访问响应数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文