Android应用上的Open Graph错误:操作需要至少一个参考

问题描述 投票:0回答:1

尝试发布Open Graph故事时,我收到以下错误。

Error{FacebookServiceException: httpResponseCode: -1, facebookErrorCode: 1611072, facebookErrorType: null, message: Action
 Requires At Least One Reference: The action you're trying to publish
 is invalid because it does not specify any reference objects. At least
 one of the following properties must be specified: victory.

我没有在文档中找到有关此属性胜利的任何内容。

我用来发布故事的代码:

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
                .putString("og:type", "games")
                .putString("og:title", "<Title>")
                .putString("og:url","<website>")
                .putString("og:image","<image link>")
                .putString("og:description", "Teste")
                .build();

        ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                .setActionType("games.celebrate")
                .putObject("games", object)
                .build();

        ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
                .setPreviewPropertyName("games")
                .setAction(action)
                .build();

        ShareDialog.show(thisActivity, content);

我怎样才能使它工作?

android facebook opengraph facebook-android-sdk
1个回答
2
投票

根据https://developers.facebook.com/docs/reference/opengraph/action-type/games.celebrate/,您已经编写了如下代码块。尝试相反,你使用,有一些变化,如"og:type", "games.victory".putObject("games:victory", object)。所以在代码中进行更改。

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
    .putString("og:type", "games.victory")
    .putString("og:title", "QoF")
    .putString("og:url","https://appsonfire33.wixsite.com/website")
    .putString("og:image:url","https://static.wixstatic.com/media/792c0f_ee1843bfce26447ab34eead294163182~mv2.png/v1/fill/w_80,h_80,al_c,usm_0.66_1.00_0.01/792c0f_ee1843bfce26447ab34eead294163182~mv2.png")
    .putString("og:description", "Teste")
    .build();

ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
    .setActionType("games.celebrate")
    .putObject("games:victory", object)
    .build();

ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
    .setPreviewPropertyName("games:victory")
    .setAction(action)
    .build();

ShareDialog.show(thisActivity, content);

希望这个帮助。

© www.soinside.com 2019 - 2024. All rights reserved.