我正在使用iPhone的最新newest Facebook connect API。我正在尝试从我的应用程序用户的朋友那里获取电子邮件地址。我只考虑那些用户的朋友,他们是相应的Facebook应用程序的用户,并且已经允许Facebook应用程序使用他们的电子邮件地址。我正在执行多重查询以获取用户的朋友的uid,然后获取朋友的信息。在请求的响应中,其他所有内容都很好,但是电子邮件地址都返回“null”。这是我的代码:
-(void)viewDidLoad{
[super viewDidLoad];
// create facebook session
NSArray *permissions = [[NSMutableArray alloc] initWithObjects:@"email", nil];
facebook = [[Facebook alloc] init];
[facebook authorize:FB_AUTH_KEY permissions:permissions delegate:self];
[permissions release];
}
-(void)requestFriendsArray{
// create the multiquery
NSString* friendIDs = @"select uid2 from friend where uid1 == me()";
NSString* namesAndPics = [NSString stringWithFormat:@"select pic_square, first_name, last_name, email, is_app_user from user where uid in (select uid2 from #friendIDs)"];
NSString* queries = [NSString stringWithFormat:@"{\"friendIDs\":\"%@\",\"namesAndPics\":\"%@\"}", friendIDs, namesAndPics];
NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:queries, @"queries", nil];
// send it out
[facebook requestWithMethodName:@"fql.multiquery" andParams:params andHttpMethod:@"GET" andDelegate:self];
[params release];
}
有人知道发生了什么事吗?
谢谢!
-Matt
答案 0 :(得分:2)
您可能需要申请延长的“邮件”权限。见http://developers.facebook.com/docs/authentication/permissions