0
是否可以使用GraphApi替換現有的FB照片?我正在使用以下代碼片段來嘗試替換該照片:如何使用GraphApi替換Facebook照片
GraphRequest fbUpload = new GraphRequest();
Bundle fbUploadParams = new Bundle();
fbUploadParams.putByteArray("source", imageData);
fbUpload.setAccessToken(AccessToken.getCurrentAccessToken());
fbUpload.setHttpMethod(HttpMethod.POST);
if (photoUploadRecord.photoId != null) {
fbUpload.setGraphPath(photoUploadRecord.photoId);
} else {
fbUpload.setGraphPath(photoUploadRecord.albumId + "/" + FloomitFb.FB_PHOTO_EDGE);
}
fbUpload.setParameters(fbUploadParams);
GraphResponse response = fbUpload.executeAndWait();
FacebookRequestError requestError = response.getError();
沒有返回錯誤,但照片未更新。代碼查看photoId,如果不爲null,則將其用作GraphPath,這是GraphApi的文檔中描述的用於更新照片的內容,但不清楚照片更新是否僅僅是指更新與之關聯的各種字段照片(評論/標籤/喜歡/等...)或圖像本身。此代碼成功上傳新照片(這是photoId == null的情況)。