我试图通过GraphRequest通过以下方式检索Facebook用户照片 代码:
var electronPath = path.join(__dirname, '..', 'node_modules', '.bin', 'electron');
if (process.platform === 'win32') {
electronPath += '.cmd';
}
var appPath = path.join(__dirname, "..", 'app/main/app.js');
appPath = "app/main/app.js";
console.log(appPath);
var app = new Application({
path: electronPath,
args: [appPath]
});
var app2 = new Application({
path: electronPath,
args: [appPath]
});
describe('Test Example', function () {
beforeEach(function () {
this.timeout(10000);
return app.start();
});
beforeEach(function () {
this.timeout(10000);
return app2.start();
});
通过使用这个鳕鱼我能够获得fb用户专辑,但它返回null数组 像这样:
})
你能告诉我如何获取fb用户照片吗?
答案 0 :(得分:2)
您已经从Facebook帐户询问get photos
。在搜索了多个小时的Facebook开发者页面后,我找到了您的问题的解决方案,我提供了获取Facebook用户照片的链接,请关注。
链接:强>
https://developers.facebook.com/docs/graph-api/reference/photo/#Reading
/* make the API call */
Bundle params = new Bundle();
bundle.putExtra("fields","images");
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/"+"USER ID"+"/photos",
params,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
/* You can parse this response using Json */
}
}
).executeAsync();