【问题标题】:Restkit [operation waitUntilFinished] not workingRestkit [操作 waitUntilFinished] 不工作
【发布时间】:2015-08-27 16:56:24
【问题描述】:

我在我的 cocoapods 库中使用 reskit 我有一个示例库,我在其中引用我自己的库来进行调用,所以当我从 IOS 示例代码进行调用时,我得到空结果。这是我的代码。

RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]];
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation                  *operation, RKMappingResult *result) {
    device = result.firstObject;
} failure:nil];

[operation start];
[operation waitUntilFinished];

return device;

【问题讨论】:

    标签: restkit nsoperation restkit-0.24.x


    【解决方案1】:

    操作完成块在操作完成后被调用,但我认为也是在操作完成后,这是你等待的。您可以使用日志语句检查这一点。因此,device 尚未设置。

    您实际上并不需要该块,只需将其删除并在您被告知操作完成后直接访问mappingResult

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多