OGeek|极客世界-中国程序员成长平台

标题: ios - 如何为我的自定义 Open Graph 故事选择要发布的灵活句子结构? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 19:09
标题: ios - 如何为我的自定义 Open Graph 故事选择要发布的灵活句子结构?

我遵循了关于使用 iOS 版 Facebook SDK 发布自定义 Open Graph 故事的教程:https://developers.facebook.com/docs/ios/open-graph/

我还在这里阅读了有关灵活句子结构的文档:https://developers.facebook.com/docs/opengraph/creating-custom-stories/#variations

我的问题是,我在代码中如何以及在何处指定要使用的特定句子结构?我想发布“John Doe 煮了牛排”而不是“John Doe 煮了一顿饭”。我想使用一对一的句子结构而不是一对一的无对象标题结构。

// Create an object
id<FBGraphObject> object =
[FBGraphObject openGraphObjectForPostWithType"myapp:meal"
                                        title"Steak"
                                        image"http://i.imgur.com/g3Qc1HN.png"
                                          url"https://example.com/link/"
                                  description"Juicy and medium-rare"];

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

// Link the object to the action
[action setObjectbject forKey"meal"];

// Check if the Facebook app is installed and we can present the share dialog
FBOpenGraphActionShareDialogParams *params = [[FBOpenGraphActionShareDialogParams alloc] init];
params.action = action;
params.actionType = @"myapp:cook";

// If the Facebook app is installed and we can present the share dialog
if([FBDialogs canPresentShareDialogWithOpenGraphActionParams:params])
{
    // Show the share dialog
    [FBDialogs presentShareDialogWithOpenGraphAction:action
                                          actionType"myapp:cook"
                                 previewPropertyName"recipe"
                                             handler:
     ^(FBAppCall *call, NSDictionary *results, NSError *error)
    {
        if(error) {
            // There was an error
            NSLog(@"Error publishing story: %@", error.description);
        } else {
            // Success
            NSLog(@"result %@", results);
        }
    }];
}



Best Answer-推荐答案


我也在试图弄清楚这一点,这就是我到目前为止理解的原因:

如果您发现其他内容,请更新您的帖子

关于ios - 如何为我的自定义 Open Graph 故事选择要发布的灵活句子结构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21923905/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4