gpt4 book ai didi

ios - 使用ios获取 friend 列表和Facebook照片

转载 作者:行者123 更新时间:2023-12-01 18:59:52 28 4
gpt4 key购买 nike

使用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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com