Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Posting to open graph does not show object title in the post

I have created a restaurant app on Facebook and have created a custom story with the action type: "eat", and object type: "dish". When the user posts to Facebook I would like the title sentence of the post to contain the title of the dish that the user has selected, for example:

"Bob ate Pie on Restaurant App"

At the moment when I post to Facebook the result that I am getting is:

"Bob ate a dish on Restaurant App".

Everything else about the post is working as intended.

Here is the code that I am using:

NSMutableDictionary <FBOpenGraphObject> *dish = [FBGraphObject openGraphObjectForPostWithType:@"restaurant-app:dish"
                                                                                        title:@"pie"
                                                                                        image:nil
                                                                                          url:nil
                                                                                  description:@"delicious pie"];

id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];

[action setObject:dish forKey:@"dish"];

[FBSettings enableBetaFeature:FBBetaFeaturesOpenGraphShareDialog];


[FBDialogs presentShareDialogWithOpenGraphAction:action
                                      actionType:@"restaurant-app:eat"
                             previewPropertyName:@"dish"
                                         handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                             if(error) {
                                                 NSLog(@"Error: %@", error.description);
                                             } else {
                                                 NSLog(@"Success!");
                                             }
                                         }];

I feel like there is just a simple mistake in the code somewhere but can't figure out what it is.

Any help would be greatly appreciated,

thanks

like image 267
Shayno Avatar asked Dec 20 '22 21:12

Shayno


1 Answers

I had the same problem. i got perfect solution try this:

  • Change the story of the type "One to One - Without Object Title" as "Object" from "Object.noun".

For e.g: Story sentense would be as follow:

"Tejas ran race with sample." Here race is my object.

  • Keep the sentence of story of the type "One to One" as Object.title as it is.

For e.g: "Tejas ran race.title with sample." Here race is my object.

Thanks, Tejas

like image 124
Tejas Bharambe Avatar answered Dec 27 '22 03:12

Tejas Bharambe