如果我使用 react-native-fbsdk 中的 LoginButton ,则 LoginBehaviour 似乎是“本地的”,因为 SDK 与已安装的 FB 应用程序通信,看到我已经授予权限并且只是登录而不显示任何对话框等。
当我使用 LoginManger.logInWithPublishPermissions() 机制时,我总是被带到浏览器和一个显示我已经授予我的应用程序权限的屏幕。我想我可以通过设置登录行为来改变它,但我不知道如何成功地做到这一点。这是我尝试过的
import { GraphRequest, GraphRequestManager, LoginManager, LoginBehaviorIOS } from 'react-native-fbsdk';
LoginManager.setLoginBehavior(LoginBehaviorIOS);
//ERROR: Argument 0 (FBSDKLoginBehaviour) of FBLoginManager: must not be null
然后我尝试了这个:
LoginManager.setLoginBehavior('native');
// No error, but still gives me the same behaviour.
LoginButton 和 LoginManager 的行为何时不同?使用 LoginManager 时如何设置登录行为,使其像 LoginButton 一样工作?
我已将所有代码添加到 AppDelegate.m 文件以及入门指南中包含的所有其他说明:https ://developers.facebook.com/docs/ios/getting-started/