使用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];
答案 0 :(得分:3)
您可以通过执行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/