我想讓我的好友家鄉&使用FB SDK for iOS的位置。但我無法檢索朋友位置&家鄉。這是我的代碼使用Facebook SDK 3.0 for iOS檢索Facebook好友的家鄉&位置和生日
- (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"]);
}
}];
}];
}
}];
}
此外我需要檢索朋友的生日。但我也不能檢索生日。
有人可以幫忙嗎?