Folk conversation for Facebook messaging not working on iOS

I am using a share dialog using the iOS SDK for Facebook. Everything works fine except for the callback. This is the function that displays the dialog:

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
    content.contentURL = <my content url>;
    content.contentTitle = <my title>;
    content.contentDescription = my description;
    content.imageURL = <my image url>;
    [FBSDKShareDialog showFromViewController:self
                                 withContent:content
                                    delegate:self];

      

The view controller implements the FBSDKSharingDelegate and three required methods:

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results;

- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error;

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;

      

Basically I have to determine if the cancel buttons were clicked because I only give them a reward if they use the content effectively. The problem is, even if I click the cancel button, only the callback is called:

- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results;

      

but not

- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;

      

as was expected. Also, using iOS8, the variable results are empty if the cancel button is clicked, otherwise it contains the post_id, but this does not happen with iOS7 where the result is always empty.

What am I doing wrong? What should I do to make the sharerDidCancel callback work correctly?

Thanks for any help!

+3


source to share


1 answer


Try putting this into your appdelegate. It worked for me to call the delegate I wanted, but the results dictionary is still empty and I can't get the post_id.



#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [FBSDKAppEvents activateApp];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                              didFinishLaunchingWithOptions:launchOptions];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                    openURL:url
                                          sourceApplication:sourceApplication
                                                 annotation:annotation];
}

      

0


source







All Articles