8
我正在使用FBDialogs在Facebook上共享。FBDialogs presentShareDialogWithParams回調處理程序永遠不會被調用
Facebook的共享工作正常,但處理程序不會被調用(我把一個斷點在第一行)
我的SDK通過的CocoaPods安裝
pod 'Facebook-iOS-SDK', '3.9.0'
這裏的代碼,相當多的例如在Facebook的開發頁面。我正在用ios7測試IPod。
// If the Facebook app is installed and we can present the share dialog
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present the share dialog
[FBDialogs presentShareDialogWithParams:params
clientState:nil
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
//never gets here
if(error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[NSString stringWithFormat: @"O comparilhando não foi bem sucedido. %@",error.description]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Sucesso"
message:@"O compartilhando foi bem sucedido"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}}];
SOLUTION:
我的老闆到底琢磨出來。 我在AppDelegate中缺少這個方法。沒有它,Facebook的不能傳遞數據回我的應用程序
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication: (NSString *)sourceApplication annotation:(id)annotation {
BOOL urlWasHandled = [FBAppCall handleOpenURL:url
sourceApplication:sourceApplication
fallbackHandler:^(FBAppCall *call) {
// incoming link processing goes here
}];
return urlWasHandled;
}
您是否檢查FaceBook會話是否打開? – MCMatan
我該如何檢查? Facebook會議到底是什麼? –