来自 RestKit 之后,我正在尝试 AFNetworking,我想知道是否有比必须为我的所有对象执行此操作更简单的解决方案:
- (id)initWithAttributes:(NSDictionary *)attributes {
// ... init
_userID = [[attributes valueForKeyPath:@"id"] integerValue];
_username = [attributes valueForKeyPath:@"username"];
_avatarImageURLString = [attributes valueForKeyPath:@"avatar_image.url"];
return self;
}
这就是 AFNetworking 基础示例中的内容。但是,一旦我带着孩子返回对象,这看起来可能会变得很麻烦。我有更简单的方法吗?
我看到这个 SO question中引用了 AFIncrementalStore 。但我不希望检索到的任何信息持续到当前会话之后,所以我认为这不是正确的做法。
提前感谢您的帮助。