FBDialogs presentShareDialogWithParams callback handler never gets called

I'm using FBDialogs to share on Facebook.

The facebook sharing works correctly, but the handler never gets called (I put a breakpoint on the first line)

My SDK is installed through CocoaPods

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

here's the code, pretty much the example on facebook dev page. I'm testing on an IPod with 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];

                                        }}];

SOLUTION:

My boss figured it out in the end. I was missing this method in my AppDelegate. Without it, facebook couldn't pass data back to my app

-(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;
}

Answers


- (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];

    }

May be this help you.


Need Your Help

Plotting multiple time series using VPlotContainers in Chaco. Limit to the number of VPlotContainer objects you can use

enthought traitsui chaco

I wish to plot multiple time series data stored in a NumPy array, in the same plot but with each time series offset, so effectively it has it's own Y axis. I figured the best way to do this may be...

PHP Fatal error: Class 'Doctrine\Common\Persistence\Mapping\Driver\FileDriver' not found

php mongodb symfony doctrine

I follow the instructions at: http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html step by step and have a Mongo server running however when I try to do :