我正在努力将 Facebook 集成到我的 iOS 应用程序中,我想知道如何将 Facebook 好友加载到表格 View 中,以便用户可以选择要邀请的好友加入游戏,这与 Words With Friends 中的做法类似。
我知道 [facebook requestWithGraphPath:@"me/friends"andDelegate:self];
从 Facebook 请求 friend ,但我无法确定从那里做什么。我想以某种方式获取 friend ID,以便向他们发送消息。
任何信息或建议将不胜感激。
提前致谢
最佳答案
- (void)getFriendsResponse {
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/friends" withGetVars:nil];// me/feed
//parse our json
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary * facebook_response = [parser objectWithString:fb_graph_response.htmlResponse error:nil];
//init array
NSMutableArray * feed = (NSMutableArray *) [facebook_response objectForKey:@"data"];
NSMutableArray *recentFriends = [[NSMutableArray alloc] init];
//adding values to array
for (NSDictionary *d in feed) {
NSLog(@"see Dicitonary :%@",d );
facebook = [[Facebook alloc]initWithFacebookDictionary:d ];
[recentFriends addObject:facebook];
NSLog(@"Postsss :->>>%@",[facebook sender]);
[facebook release];
}
friends = recentFriends;
[self.tableView reloadData];
}
然后在 TableView 中显示 NSArray
关于iphone - 加载 Facebook 好友到 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6965381/