React native React本机FBSDK登录不';不要回复电子邮件

React native React本机FBSDK登录不';不要回复电子邮件,react-native,facebook-login,react-native-fbsdk,React Native,Facebook Login,React Native Fbsdk,我正在尝试使用默认的已解决 嘿,你查过不同的facebook账户了吗?就像有些帐户没有通过电子邮件注册一样,我已经尝试使用我创建的2个帐户,使用2个不同的电子邮件。。。但结果是一样的。问题是,当我在facebook webview/native view中检查权限时,应用程序只请求public_配置文件,而不请求Email。您也可以在捕获条件下尝试public配置文件。然后用另一个帐户检查我,facebook现有的活跃帐户,它有email。没有什么改变了我们。太好了,很高兴你这么做了。我一直在努

我正在尝试使用默认的已解决


嘿,你查过不同的facebook账户了吗?就像有些帐户没有通过电子邮件注册一样,我已经尝试使用我创建的2个帐户,使用2个不同的电子邮件。。。但结果是一样的。问题是,当我在facebook webview/native view中检查权限时,应用程序只请求public_配置文件,而不请求Email。您也可以在捕获条件下尝试public配置文件。然后用另一个帐户检查我,facebook现有的活跃帐户,它有email。没有什么改变了我们。太好了,很高兴你这么做了。我一直在努力解决这个问题很长时间了,你的答案终于解决了!谢谢!
<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")}
/>
  async FBGraphRequest(fields, callback) {
    const accessData = await AccessToken.getCurrentAccessToken();

    console.log("token= ", accessData.accessToken )
    // Create a graph request asking for user information
    const infoRequest = new GraphRequest('/me', {
      accessToken: accessData.accessToken,
      parameters: {
        fields: {
          string: fields
        }
      }
    }, this.FBLoginCallback.bind(this));
    // Execute the graph request created above
    new GraphRequestManager().addRequest(infoRequest).start();
  }

  async FBLoginCallback(error, result) {
    if (error) {
      this.setState({
        showLoadingModal: false,
        notificationMessage: "facebook error"
      });
    } else {
      // Retrieve and save user details in state. In our case with 
      // Redux and custom action saveUser
      this.setState({
        id: result.id,
        email: result.email,
        name: result.name
      });
      console.log("facebook login",result)
    }

  }
async facebookLogin() {
    // native_only config will fail in the case that the user has
    // not installed in his device the Facebook app. In this case we
    // need to go for webview.
    let result;
    try {
      this.setState({showLoadingModal: true});   
      LoginManager.setLoginBehavior('NATIVE_ONLY');
      result = await LoginManager.logInWithReadPermissions(['public_profile', 'email']);
    } catch (nativeError) {
      try {
        LoginManager.setLoginBehavior('WEB_ONLY');
        result = await LoginManager.logInWithReadPermissions(['email']);
      } catch (webError) {
        // show error message to the user if none of the FB screens
        // did not open
      }
    }
    console.log("facebook result 1: ", result)
    // handle the case that users clicks cancel button in Login view
    if (result.isCancelled) {
      this.setState({
        showLoadingModal: false,
        notificationMessage: I18n.t('welcome.FACEBOOK_CANCEL_LOGIN')
      });
    } else {
      // Create a graph request asking for user information
      this.FBGraphRequest('id, email, name', this.FBLoginCallback);
    }
  }
.
.
.
        <LoginButton   
          publishPermissions={["email"]}
          onPress={
            this.facebookLogin()
          }
          onLogoutFinished={() => alert("User logged out")}
          />
<LoginButton
   permissions={['public_profile', 'email', 'user_birthday', ]}

   onClick={this.facebookLogin}
/>