[未处理的承诺拒绝:TypeError:未定义不是对象(正在评估'NativeGraphRequestManager.start')]

时间:2018-06-24 23:12:21

标签: 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",
"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,但似乎无法弄清楚原因。也许我按得太久了,现在已经死了。

感谢您的帮助。谢谢。

0 个答案:

没有答案