Celebrate a victory with Open Graph on iOS

727 Views Asked by At

After almost 2 days of reading through the Facebook docs, I still can't figure out why oh why my code for simply publishing a game victory does not work. If I use Facebook Sample's object, it does work (uncommented), but once I use the object, the app crashes and opens the browser (in simulator) and returns to the game again. The code is as follows:

NSDictionary *properties = @{
                                 @"og:type": @"games.victory",
                                 @"og:title": @"A Game Victory",
                                 @"og:description": @"Awsum description",
                                 };
    FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];

    // Create an action
    FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
    action.actionType = @"games.celebrate";
    [action setString:@"http://samples.ogp.me/500426766634310" forKey:@"victory"];
 //   [action setObject:object forKey:@"victory"];

    // Create the content
    FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
    content.action = action;
    content.previewPropertyName = @"victory";




    [FBSDKShareDialog showFromViewController:self
                                 withContent:content
                                    delegate:nil];

What am I doing wrong and how can I fix this, I'm quite done with the FB documentation. Also, how could I know whether the story has been posted successfully in my app? Is there some delegate callback function or anything like that?

0

There are 0 best solutions below