3
我試圖通過發送FBRequest並在不同視圖中的表格上顯示結果來獲取朋友的生日,地點和姓名。但我總是收到零迴應。我首先設置的權限,然後創建與所需的字段的請求:FBRequest問題 - 獲取朋友的信息
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_birthday",@"friends_hometown",
@"friends_birthday",@"friends_location",
nil];
if (!FBSession.activeSession.isOpen) {
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState state,
NSError *error) {
if (error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
} else if (session.isOpen) {
NSLog(@"permissions::%@",session.permissions);
NSLog(@"Open");
FTBFriendTableViewController *ftbFriendTableViewController= [[FTBFriendTableViewController alloc] initWithNibName:@"FTBFriendTableViewController" bundle:nil];
FTBAppDelegate *delegate=(FTBAppDelegate*)[[UIApplication sharedApplication] delegate];
if (ftbFriendTableViewController.friendList == nil){
ftbFriendTableViewController.friendList = [[NSMutableArray alloc] init];
}
FBRequest *friendRequest = [FBRequest requestForGraphPath:@"me/friends?fields=name,birthday,location"];
[ friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
ftbFriendTableViewController.friendList = [result objectForKey:@"data"];
for (FBGraphObject<FBGraphUser> *friend in test) {
NSLog(@"%@:%@", [friend name],[friend birthday]);
}}];
delegate.window.rootViewController = ftbFriendTableViewController;
}
}];
return;
}
我還設置FacebookAppID,FacebookDisplayName和URL標識符在應用plist中。這是發送實際的請求:
FBRequest:0x94c1080,會議:0xa1c5600,graphPath:我/朋友欄=姓名,生日,地點,列舉HTTPMethod:GET,參數:{ 「migration_bundle」=「fbsdk :20130409" ; }
任何想法還有什麼可以導致沒有響應問題?謝謝!