在第一个功能中,我将多个图像上载到page-id/photos这些图像的所有ID并收到肯定的响应。但是下一部分是我遇到的问题;我现在正尝试在Facebook页面时间轴上创建包含多张图片的帖子。但是,我收到一个奇怪的错误响应,声称我已经上传了图像。我什至在使用Open Graph Explorer的文档中都遵循了Facebook的示例,但这只是返回了另一个错误发送图像的功能:(没有问题的作品)sendFacebookImagePost(page) { const attached_media = [] for(let i = 0; i < this.state.upload_imgsrc.length; i++) { let reader = new FileReader(); reader.onload = (e) => { let arrayBuffer = e.target.result; let blob = new Blob([arrayBuffer], { type: this.state.upload_imgsrc[i].type }); let data = new FormData() data.append("source", blob) data.append("message", this.state.fb_message) data.append("no_story", true) data.append("published", true) axios({ method: "post", url: "https://graph.facebook.com/" + page.id + "/photos?access_token=" + page.accessToken, data: data }) .then(response => { attached_media.push({media_fbid: response.data.id}) if (attached_media.length === this.state.upload_imgsrc.length) { this.sendFacebookPost(page, attached_media) } }) .catch(error => { console.log(error); }) } reader.readAsArrayBuffer(this.state.upload_imgsrc[i]); }}
1 回答

白衣非少年
TA贡献1155条经验 获得超0个赞
发生问题的部分是我在图片中添加了以下内容:data.append("published", true)
。
显然,要在多张照片帖子中使用的图像必须先设置为,published: false
然后才能在帖子中使用。否则,Facebook将其视为已上传。
添加回答
举报
0/150
提交
取消