" in all requests-6ren"> " in all requests-在使用“nil”keyPath 执行 Restkit 请求后,它工作正常,我得到它的响应: "" = "" 但我仍然在下一个请求的所有映射结果中得到它,就像这样: "" = ""; "my_estab-6ren">
gpt4 book ai didi

ios - 休息套件 : getting mappingResult with "" in all requests

转载 作者:行者123 更新时间:2023-11-29 02:18:50 24 4
gpt4 key购买 nike

在使用“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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com