I request something with POST, and the server just sends status-code 200 with a content-length of 0 back. How can I handle this? I'm not allowed to add a RKResponseDescriptor without mapping, nor not add the RKResponseDescriptor.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Ah, I just found out, you can create a mapping for the NSNull class. That seems to work. Here's the code:
{
RKObjectMapping* responseMapping = [RKObjectMapping mappingForClass:[NSNull class]];
RKResponseDescriptor* response =
[RKResponseDescriptor responseDescriptorWithMapping:responseMapping
method:RKRequestMethodAny
pathPattern:@"entry/sync"
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[restObjectManager addResponseDescriptor:response];
}
Please tell me if this is the right way.