gpt4 book ai didi

ios - restkit 0.20 - (无效) objectLoader didLoadObjects & 其他旧方法

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:48:05 25 4
gpt4 key购买 nike


我对 restkit 0.20 有点困惑,我知道他们添加了 AFNetworking,所以他们重写了很多方法。
现在我正在寻找与 objektLoaders 几乎相同的方法,例如我想使用:

1.
- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects {}
2.
- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error{}
3.
- (void)objectLoaderDidFinishLoading:(RKObjectLoader *)objectLoader{}

有人会如此友善并给我一些正确方法的提示吗?非常感谢!

最佳答案

查看他们的 wiki page关于迁移到 0.20.0

该页面中与该问题相关的示例似乎是:

这个

[ [RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/examples" usingBlock:^(RKObjectLoader *loader) {
loader.onDidLoadObjects = ^(NSArray *objects) {
NSLog(@"It Worked: %@", objects);
};
loader.onDidFailWithError = ^(NSError *error) {
NSLog(@"It Failed: %@", error);
};
}];

成为

[RKObjectManager.sharedManager getObjectsAtPath:path parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
{
NSLog(@"It Worked: %@", [mappingResult array]);
// Or if you're only expecting a single object:
NSLog(@"It Worked: %@", [mappingResult firstObject]);
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"It Failed: %@", error);
}];

关于ios - restkit 0.20 - (无效) objectLoader didLoadObjects & 其他旧方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13971221/

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