嵌套查询在iOS sdk中不起作用,但在loopback explorer

时间:2017-06-15 16:09:03

标签: ios loopback

目前我正在开发一个使用iOS loopback sdk获取值的项目。如果它是一个查询,那么这本书的所有内容都可以使用。

但是当嵌套查询(如下所示)发生时,它会显示错误

Error Domain=AFNetworkingErrorDomain Code=-1011 "Expected status code in (200-299), got 500" UserInfo={NSLocalizedRecoverySuggestion={"error":{"name":"Error","status":500,"message":"Relation \"relation\" is not defined for UserGroup model","stack":"Error: Relation \"relation\" is not defined for UserGroup model

查询如下

NSDictionary *filterParams = @{
                                   @"where" : @{
                                           @"group_id" : self.groupDetails[@"groupId"]},
                                   @"include" : @[@"invitedusers",
                                                  @{
                                                      @"relation" : @"userstatus",
                                                      @"scope": @{
                                                              @"include":@[ @"useruploads" ]
                                                        }
                                                }]
                                   };

1 个答案:

答案 0 :(得分:1)

NSDictionary *filterParams = @{
                               @"where" : @{
                                       @"group_id" : self.groupDetails[@"groupId"]
                                       },
                               @"include" : @[ @"invitedusers",
                                               @{
                                                   @"userstatus" : @"useruploads"
                                                   }
                                               ]
                               };

您也可以参考:https://loopback.io/doc/en/lb2/Include-filter.html