我无法同时获取 Facebook 名称和图片。每个请求我只能接受其中一个。
-(void)fbDidLogin{
// Save the access token key info.
[self saveAccessTokenKeyInfo];
// Get the user's info.
[facebook requestWithGraphPath:@"me/?fields=first_name,picture" andDelegate:self];
}
-(void)request:(FBRequest *)request didLoad:(id)result{
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
if ([result objectForKey:@"first_name"]) {
[lblUser setText:[NSString stringWithFormat:@"Welcome %@!", [result objectForKey:@"first_name"]]];
// Show the publish button.
[btnPublish setHidden:NO];
}
}
else {
imageView.image = [UIImage imageWithData:result];
}
}
我得到的错误
__NSCFDictionary length]: unrecognized selector sent to instance
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary length]: unrecognized selector sent to instance
如果我提出两个请求
-(void)fbDidLogin{
// Save the access token key info.
[self saveAccessTokenKeyInfo];
// Get the user's info.
[facebook requestWithGraphPath:@"me/picture" andDelegate:self];
[facebook requestWithGraphPath:@"me" andDelegate:self];
}
并且使用相同的 -(void)request:(FBRequest *)request didLoad:(id)result 我得到的错误是
[__NSCFDictionary length]: unrecognized selector sent to instance
那么我如何请求获取 Facebook 名称和图片以及如何处理传入数据?