2
任何人都可以幫助我。我無法弄清楚如何使用最新的Facebook SDK(v 3.1)爲iOS創建單個FQL查詢來獲取用戶朋友的生日和電子郵件。當我查詢名稱這樣的字段時,我會得到正確的值,但在電子郵件和生日字段中爲空。使用v3.1的FQL查詢Facebook SDK for iOS獲取生日和電子郵件
這裏是我的代碼
- (void)facebookViewControllerDoneWasPressed:(id)sender {
// we pick up the users from the selection, and create a string that we use to update the text view
// at the bottom of the display; note that self.selection is a property inherited from our base class
for (id<FBGraphUser> user in _friendPickerController.selection) {
_nameTxt.text = user.name;
NSString *fql = [NSString stringWithFormat:@"SELECT email, birthday, name FROM user WHERE uid = %@ ",user.id];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"q"];
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:params
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
NSLog(@"Error: %@", [error localizedDescription]);
} else {
NSLog(@"Result: %@", result);
}
}];
}
[self.navigationController dismissModalViewControllerAnimated:YES];
}
我收到的電子郵件和生日的名稱值,但空。
感謝
權限有什麼你應用程序要求?你有沒有要求電子郵件和user_birthday? –
@CAbernathy我不這麼認爲,我的應用程序正在要求這些權限。我是這個Facebook Graph API的新手,你能告訴我我需要做什麼嗎? –
這個問題讓我得到了我無法在其他地方找到答案。 –