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

馋奶兔 提交于 2019-11-30 14:17:56

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/20026694/posting-to-open-graph-does-not-show-object-title-in-the-post

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!