我正在嘗試使用FBFriendPickerViewController
來獲取發送應用邀請的Facebook好友列表。每當我測試代碼時,朋友列表都是空的。請參閱下面的代碼:FBFriendPickerViewController好友列表爲空
@implementation FacebookInviteViewController
- (void)showFriendPicker
{
FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
friendPicker.title = @"Invite Friends";
friendPicker.delegate = self;
[friendPicker loadData];
AppController *appController = (AppController *)[[UIApplication sharedApplication] delegate];
[appController.navController presentViewController:friendPicker animated:YES completion:nil];
}
-(void)inviteFromFacebookSelected
{
if (!FBSession.activeSession.isOpen) {
[FBSession openActiveSessionWithReadPermissions:nil
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) {
[self showFriendPicker];
}
}];
} else {
[self showFriendPicker];
}
}
在設置類(從CCLayer子類)我叫下面的方法時,Facebook的按鈕被按下
-(void)showFbConnect {
facebookInviteViewController = [[FacebookInviteViewController alloc] init];
[facebookInviteViewController inviteFromFacebookSelected];
}
我怎樣才能解決這個問題呢?
無論如何,我可以發送Facebook請求給所有我的朋友(誰不玩我的應用程序)玩嗎? – errorallergic 2014-10-10 18:32:09
我知道我遲到了,但你可能想看看這個https://developers.facebook.com/docs/games/invitable-friends/v2.2 – 2014-11-10 07:31:43