FBGraphObject的功能非常有用,通过点表示法访问和设置NSMutableDictionary是一个很好的功能。来自here的更多信息。
我有一个鸭子协议。
@protocol Duck <FBGraphObject>
@property (nonatomic, strong) NSNumber *objectID; // id key
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *description;
@end
// Now I can do this.
NSDictionary *anAnimal = @{@"id":@1, @"name":@"donald", @"description":@"Its a duck that talks!!"};
NSMutableDictionary <Duck> *aDuck = (NSMutableDictionary <Duck> *) [FBGraphObject graphObjectWrappingDictionary:anAnimal];
NSLog(@"aDuck name via Key: %@",[aDuck objectForKey:@"name"]);
NSLog(@"aDuck name via Dot Notation: %@",aDuck.name);
NSLog(@"aDuck description via Key: %@",[aDuck objectForKey:@"description"]);
NSLog(@"aDuck description via Dot Notation: %@",aDuck.description);
上面的代码工作正常。
所以我的问题是,在FacebookSDK范围之外使用FBGraphObject时是否存在任何问题/问题,就像上面的代码一样?