ios - restkit 0.20 - (void) objectLoader didLoadObjects & 其他旧方法
<p><p><br/>
我对restkit 0.20有点困惑,我知道他们添加了AFNetworking,所以他们重写了很多方法。<br/>
现在我正在寻找与 objektLoaders 几乎相同的方法,例如我想使用:</p>
<pre><code>1.
- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects {}
2.
- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error{}
3.
- (void)objectLoaderDidFinishLoading:(RKObjectLoader *)objectLoader{}
</code></pre>
<p>有人会这么好心并给我一个正确方法的提示吗?非常感谢!</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>查看他们的<a href="https://github.com/RestKit/RestKit/wiki/Upgrading-from-v0.10.x-to-v0.20.0" rel="noreferrer noopener nofollow">wiki page</a>关于迁移到 0.20.0</p>
<p>该页面中与该问题相关的示例似乎是:</p>
<p>这个</p>
<pre><code>[ loadObjectsAtResourcePath:@"/examples" usingBlock:^(RKObjectLoader *loader) {
loader.onDidLoadObjects = ^(NSArray *objects) {
NSLog(@"It Worked: %@", objects);
};
loader.onDidFailWithError = ^(NSError *error) {
NSLog(@"It Failed: %@", error);
};
}];
</code></pre>
<p>变成</p>
<pre><code>[RKObjectManager.sharedManager getObjectsAtPath:path parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
{
NSLog(@"It Worked: %@", );
// Or if you're only expecting a single object:
NSLog(@"It Worked: %@", );
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"It Failed: %@", error);
}];
</code></pre></p>
<p style="font-size: 20px;">关于ios - restkit 0.20 - (void) objectLoader didLoadObjects & 其他旧方法,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/13971221/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/13971221/
</a>
</p>
页:
[1]