使用facebook ios sdk,如何获得我所有好友列表及其照片的NSArray
?
FBLoginView *loginView = [[FBLoginView alloc] initWithReadPermissions:
@[@"public_profile", @"email", @"read_friendlists"]];
loginView.delegate = self;
loginView.frame = CGRectOffset(loginView.frame, (self.view.center.x - (loginView.frame.size.width / 2)), 250);
[self.view addSubview:loginView];
最佳答案
您可以通过执行fql请求来执行此操作
使用iOS Facebook sdk,您可以发出如下请求:
- (IBAction)queryButtonAction:(id)sender {
// Query to fetch the active user's friends, limit to 25.
NSString *query =
@"SELECT uid, name, pic_square FROM user WHERE uid IN "
@"(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";
// Set up the query parameter
NSDictionary *queryParam = @{ @"q": query };
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
}
这是从此处获取的示例:https://developers.facebook.com/docs/ios/graph#fql
在这里阅读更多有关此的内容:
https://developers.facebook.com/docs/ios/graph
好友列表记录在这里:
https://developers.facebook.com/docs/reference/fql/friendlist/
关于ios - 使用ios获取 friend 列表和Facebook照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23540705/