fbsdk响应本机GraphRequestManager发布参数

时间:2017-10-25 22:46:29

标签: facebook-graph-api react-native-fbsdk

我正在尝试使用Facebook发布到GraphRequest API的页面功能,但我正在尝试发布子附件时遇到麻烦。它说它希望子附件字段为数组(https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed) 但是当我以下面的格式给出它时,反应本机吐出以下错误:

JSON value '(
        {
        link = "google.com";
        picture = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png";
    }
)' of type NSMutableArray cannot be converted to NSString

以下代码:

 const postRequestParams = {
            message: {
                string: 'Hi!'
            },
                    child_attachments: {
                                    string: [{link: 'google.com', picture: 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'}]

        }

    }

    const postRequestConfig = {
        httpMethod: 'POST',
        version: 'v2.10',
        parameters: postRequestParams,
        accessToken: pageAccessToken
    }

     new GraphRequestManager().addRequest(new GraphRequest('/' + fb_page_id + '/feed', postRequestConfig,  (error, result) => {
                if (error) {
                  console.log(error)
                  //alert('Error Sharing Post to Facebook: ' + error.toString());



                } else {

                  console.log("post ot Fb page was successful")


                }
              })).start()

0 个答案:

没有答案