我正在尝试使用适用于 iOS 的 FB SDK 获取我朋友的家乡和位置。但我无法检索朋友的位置和家乡。这是我的代码
- (IBAction)btnFBLoginTapped:(id)sender {
NSArray *permissions = [[NSArray alloc]initWithObjects:@"email",@"user_birthday",@"user_hometown",@"user_location",@"friends_birthday",@"friends_location",@"friends_hometown", nil];
[FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// session might now be open.
if (session.isOpen) {
FBRequest *me = [FBRequest requestForMe];
[me startWithCompletionHandler: ^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *my,
NSError *error) {
NSLog(@"My dcitionary:- %@",my);
NSLog(@"Sessionkey:- %@",session.accessToken);
// Friend request
FBRequest *friendRequest = [FBRequest requestForMyFriends];
[friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
NSDictionary *resultDictionary = (NSDictionary *)result;
NSArray *data = [resultDictionary objectForKey:@"data"];
NSLog(@"Data:- %@",data);
for (NSDictionary *dic in data) {
NSLog(@"ID:- %@",[dic objectForKey:@"id"]);
}
}];
}];
}
}];
}
我还需要检索朋友的生日。但我也无法检索生日。
有人可以帮忙吗?