gpt4 book ai didi

javascript - React native 无法将读取权限(电子邮件)传递给发布授权请求

转载 作者:数据小太阳 更新时间:2023-10-29 04:14:22 25 4
gpt4 key购买 nike

我正在 React Native 应用程序中实现 fb sdk。我已经完成了 link 的所有更改,并在安卓设备上运行。单击 Facebook 登录按钮时应用程序崩溃,这些是日志。

05-23 10:42:20.559 7063-7063/com.fbsample E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.fbsample, PID: 7063
Cannot pass a read permission (email) to a request for publish authorization
at com.facebook.login.LoginManager.validatePublishPermissions(LoginManager.java:444)
at com.facebook.login.LoginManager.logInWithPublishPermissions(LoginManager.java:416)
at com.facebook.login.widget.LoginButton$LoginClickListener.performLogin(LoginButton.java:753)
at com.facebook.login.widget.LoginButton$LoginClickListener.onClick(LoginButton.java:725)
at com.facebook.FacebookButtonBase$1.onClick(FacebookButtonBase.java:384)
at android.view.View.performClick(View.java:4785)
at android.view.View$PerformClick.run(View.java:19884)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

我搜索了很多,但没有一个能帮助我解决这个问题。

至少错误应该包含一个建议。

我被困了几个小时 :/

Facebook 文档中没有任何新内容。

我有FBLoginButton.js

    import React, { Component } from 'react';
import { View } from 'react-native';
import { LoginButton } from 'react-native-fbsdk';

export default class FBLoginButton extends Component {
render() {
return (
<View>
<LoginButton
publishPermissions={["email"]}
onLoginFinished={
(error, result) => {
if (error) {
alert("Login failed with error: " + error.message);
} else if (result.isCancelled) {
alert("Login was cancelled");
} else {
alert("Login was successful with permissions: " + result.grantedPermissions)
}
}
}
onLogoutFinished={() => alert("User logged out")}/>
</View>
);
}
};

module.exports = FBLoginButton;

App.js

import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View
} from 'react-native';
var FBLoginButton = require('./FBLoginButton');
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.label}>Welcome to the Facebook SDK for React Native!</Text>
<FBLoginButton />
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

有人告诉我为什么这个问题仍然存在,我能做些什么来解决它。

最佳答案

你必须改变publishPermissions={["email"]}readPermissions={["email"]}

关于javascript - React native 无法将读取权限(电子邮件)传递给发布授权请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50480387/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com