Mun*_*ner 4 facebook facebook-graph-api ios facebook-javascript-sdk react-native
我成功地创建了一个成功将用户登录到Facebook的本机组件.所以,在我的react-native应用程序中,我有访问令牌和userId.现在,我想使用Facebook SDK(例如,图谱API)访问一些基本信息(个人资料名称,个人资料图片等)并做基本的事情(分享帖子等)
在这一点上,我很遗憾:我怎么能这样做?我可以使用fetch API吗?我是否需要在我的应用程序中添加一些节点插件(我正在寻找这个:https://github.com/Thuzi/facebook-node-sdk)?
您可以使用fetch API发出这样的请求,其中查询可以是https://graph.facebook.com/me?access_token=token_you_got
fetch('https://graph.facebook.com/me?access_token=token_you_got')
.then(response => response.json())
.then(json => this._handleResponse(json.response))
.catch(error =>
this.setState({
isLoading: false,
message: 'Something bad happened ' + error
}));
Run Code Online (Sandbox Code Playgroud)
更多信息请访问:http://www.raywenderlich.com/99473/introducing-react-native-building-apps-javascript
| 归档时间: |
|
| 查看次数: |
2721 次 |
| 最近记录: |