FBDialogs presentShareDialogWithParams callback handler never called

I use FBDialogs to post on Facebook.

Facebook sharing works correctly, but the handler is never called (I set a breakpoint on the first line)

My SDK is installed through CocoaPods

pod 'Facebook-iOS-SDK', '3.9.0' 

here is the code, pretty much an example on the facebook dev page. I am testing an iPod using ios7.

 // 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]; }}]; 

Decision

My boss realized this at the end. I missed this method in the AppDelegate app. Without it, facebook could not transfer the data back to my application.

 -(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; } 
+8
handler callback ios facebook sdk
source share
1 answer
 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if ([[[[NSString stringWithFormat:@"%@",url] componentsSeparatedByString:@":"] objectAtIndex:0]isEqualToString:@"your FB ID"]) { return [FBSession.activeSession handleOpenURL:url]; } 

Maybe this will help you.

0
source share

All Articles