Javascript [未处理的承诺拒绝:TypeError:undefined不是对象(正在评估';NativeGraphRequestManager.start';)]
试图在我的应用程序中实现FBSDK和UBER SDK,但它似乎不起作用。我的封面图像一直在加载,事件不会成功 这是我的尝试! 这是我的package.json文件Javascript [未处理的承诺拒绝:TypeError:undefined不是对象(正在评估';NativeGraphRequestManager.start';)],javascript,api,react-native,expo,react-native-fbsdk,Javascript,Api,React Native,Expo,React Native Fbsdk,试图在我的应用程序中实现FBSDK和UBER SDK,但它似乎不起作用。我的封面图像一直在加载,事件不会成功 这是我的尝试! 这是我的package.json文件 "react": "^16.4.1", "react-native": "^0.55.4", "react-native-calendar-events": "^1.6.1", "react-native-easy-grid": "^0.1.17", "react-native-events": "^1.0.7", "reac
"react": "^16.4.1",
"react-native": "^0.55.4",
"react-native-calendar-events": "^1.6.1",
"react-native-easy-grid": "^0.1.17",
"react-native-events": "^1.0.7",
"react-native-fbsdk": "^0.7.0",
"react-native-maps": "^0.21.0",
"react-native-uber-rides": "^0.4.3",
"react-native-uber-rides-estimates": "^0.1.0",
这是我对fb的声明
const FBSDK = require('react-native-fbsdk');
const {
GraphRequest,
GraphRequestManager} = FBSDK;
以下是我试图从facebook页面中提取事件的尝试
getFBEvents = () => {
const infoRequest = new GraphRequest(
'/' + this.state.fbPageId + '/events',
{
accessToken: this.state.fbPageToken,
parameters: {
limit: {
string: '1000'
},
time_filter: {
string: 'upcoming'
},
fields: {
string: 'description,end_time,name,place,id,start_time,ticket_uri'
}
}
},
(error, result) => {
if (!error) {
this.state.fbEventLoaded = true;
let data = result.data
RNCalendarEvents.authorizationStatus()
.then(status => {
if (status === 'authorized')
{
this.saveEvent(data)
}
else if (status === 'undetermined')
{
RNCalendarEvents.authorizeEventStore()
.then(status => {
if (status === 'authorized')
{
this.saveEvent(data)
}
})
.catch(error => {
});
}
})
.catch(error => {
});
}
}
);
new GraphRequestManager().addRequest(infoRequest).start();
这是试图从facebook页面上翻出封面
getFBCoverPhoto = () => {
const infoRequest = new GraphRequest(
'/' + this.state.fbPageId,
{
accessToken: this.state.fbPageToken,
parameters: {
fields: {
string: 'cover'
}
}
},
(error, result) => {
if (!error) {
console.log('result.cover.source:' +result.cover.source)
this.state.imgSource = result.cover.source
}
}
);
new GraphRequestManager().addRequest(infoRequest).start();
试图找出我的数据无法正确读取的原因。
我一直收到NativeGraphRequestManager.start()的TypeError,但我似乎不知道为什么。也许我压得太久了,现在我已经脑死亡了
感谢您的帮助。谢谢。忘记打电话了。构造函数(props){super(props)this.state={webViewHeight:100,imgSource:undefined,fbEventLoaded:false,fbPageId:'',fbPageToken:''}}}异步组件willMount(){this.getFBCoverPhoto()this.getFBEvents()}可能是调用中的
accessToken
是null
?