我正在使用 Parse SDKapprequests
在我的应用程序中实现 Facebook 对话框。出于所有意图和目的,它只是包装了 Facebook SDK,在 Facebook 方法前加上PF_
.
我使用这段代码来准备和引发对话框:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSString stringWithFormat:@"I just challenged you to a game!"], @"message",
[friendIds componentsJoinedByString:@"," ], @"to",
nil];
PF_FBSession *session = [PFFacebookUtils session];
PF_Facebook *facebook = [[PF_Facebook alloc] initWithAppId:session.appID andDelegate:nil];
facebook.accessToken = session.accessToken;
facebook.expirationDate = session.expirationDate;
[facebook dialog:@"apprequests" andParams:params andDelegate:self];
这很好用,我得到了对话框,我可以邀请朋友玩这个应用程序。
问题是没有调用委托方法,即使我已将视图控制器设置为PF_FBDialogDelegate
:
@interface ChallengeFriendsViewController : UIViewController <UITableViewDelegate, PF_FBDialogDelegate> {
NSArray *facebookFriends;
NSMutableArray *selectedFriends;
}
这些是我正在谈论的一些委托方法:
- (void)dialog:(PF_FBDialog *)dialog didFailWithError:(NSError *)error {
NSLog(@"Error in Dialog: %@", error);
}
- (void)dialogDidNotCompleteWithUrl:(NSURL *)url {
NSLog(@"Failure on Facebook server side");
}
- (void)dialogCompleteWithUrl:(NSURL *)url {
NSLog(@"Did complete with URL");
[self.navigationController popViewControllerAnimated:YES];
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}
- (void)dialogDidNotComplete:(PF_FBDialog *)dialog {
NSLog(@"Cancelled");
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}
如果不调用这些方法,我真的无法以直观的方式处理共享。我很困惑为什么不叫他们,觉得我已经尝试了一切。任何指向我哪里出错的指针?