Facebook login flutter app error with native login

I am trying to integrate facebook login with Flutter. Facebook login working with FacebookLoginBehavior.webViewOnly but I want to login with native dialog. This is not woking in flutter. (iOS only)....

Future<bool> facebookLogin( BuildContext context, bool isCoach, AuthMode authMode) async { final facebookLogin = FacebookLogin(); facebookLogin.loginBehavior = FacebookLoginBehavior.nativeOnly; final result = await facebookLogin.logInWithReadPermissions(['email']); print(result.status); if (result.status == FacebookLoginStatus.loggedIn) { var _token = result.accessToken.token; return true; } return false; } Logs: flutter: FacebookLoginStatus.cancelledByUser 
3

1 Answer

As per the issue list for the plugin this is a bug for iOS 13 ()

Use the device_info package and you can put the following check for the iOS 13 device so the rest of the world enjoys the native view

if (Platform.isIOS){ DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); IosDeviceInfo iosInfo = await deviceInfo.iosInfo; String iosSystemVersion = iosInfo.systemVersion; if (iosSystemVersion.startsWith('13')){ print('Running on IOS version $iosSystemVersion. Forcing facebook login to be webViewOnly'); _facebookSignIn.loginBehavior = FacebookLoginBehavior.webViewOnly; } } 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like