如果我使用react-native-fbsdk中的LoginButton,LoginBehaviour似乎是「native」,因爲SDK與安裝的FB應用程序進行通信,發現我已經授予了權限,只是登錄了我而不顯示任何對話框,等等如何在使用react-native-fbsdk LoginManager時設置LoginBehaviour?
當我使用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/
所以我可以證實這個作品。 'LoginManager.setLoginBehavior(Platform.OS ==='ios'?'web':'web_only')'。他們在他們的文檔中聲明,即使您將其設置爲「native」,SDK仍可能選擇webview。 –