作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
" in all requests-6ren"> " in all requests-在使用“nil”keyPath 执行 Restkit 请求后,它工作正常,我得到它的响应: "" = "" 但我仍然在下一个请求的所有映射结果中得到它,就像这样: "" = ""; "my_estab-6ren">
在使用“nil”keyPath 执行 Restkit 请求后,它工作正常,我得到它的响应:
"<null>" = "<EstablishmentReservationsMapping: 0x7fc42d1140f0>"
但我仍然在下一个请求的所有映射结果中得到它,就像这样:
"<null>" = "<EstablishmentReservationsMapping: 0x7fc42d1140f0>";
"my_establishments" = (
"<Establishment: 0x7fc42f89ae10>",
"<Establishment: 0x7fc42f89b220>",
"<Establishment: 0x7fc42f89b8f0>",
"<Establishment: 0x7fc42f90bd10>",
"<Establishment: 0x7fc42f990d60>",
"<Establishment: 0x7fc42f93a650>",
"<Establishment: 0x7fc42f9e6bb0>",
"<Establishment: 0x7fc42fe9a0a0>",
"<Establishment: 0x7fc42f9dcbc0>"
);
我只想得到:
"my_establishments" = (
"<Establishment: 0x7fc42f89ae10>",
"<Establishment: 0x7fc42f89b220>",
"<Establishment: 0x7fc42f89b8f0>",
"<Establishment: 0x7fc42f90bd10>",
"<Establishment: 0x7fc42f990d60>",
"<Establishment: 0x7fc42f93a650>",
"<Establishment: 0x7fc42f9e6bb0>",
"<Establishment: 0x7fc42fe9a0a0>",
"<Establishment: 0x7fc42f9dcbc0>"
);
这是第二个请求的响应responseDescriptor:
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:establishmentMapping method:RKRequestMethodGET pathPattern:nil keyPath:@"my_establishments" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
[_objectManager addResponseDescriptor:responseDescriptor];
最佳答案
问题是 pathPattern:nil
因为这意味着所有响应描述符将始终被考虑用于每个响应。在许多情况下,这会导致创建空对象。
要修复,请将路径模式添加到每个响应描述符,以便 RestKit 可以告诉它应该使用哪个。
关于ios - 休息套件 : getting mappingResult with "<null>" in all requests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28409253/
在使用“nil”keyPath 执行 Restkit 请求后,它工作正常,我得到它的响应: "" = "" 但我仍然在下一个请求的所有映射结果中得到它,就像这样: "" = ""; "my_estab
我是一名优秀的程序员,十分优秀!