App rejected by Apple because Facebook Login

ios

#1

Hi!
I’m using the “nativescript-localize”: “^2.3.0”, plugin as shown on the screenshots.
.

As posted in https://github.com/NativeScript/nativescript-facebook/issues/93

Apple rejected my app because “We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.”
Any idea to solve it?
Thanks!


#2

Are you customizing LoginBehavior to LoginBehaviorBrowser, default should be LoginBehaviorNative?


#3

view
<Button [text]=“fbLogin” (tap)=“loginFB()” class=“fa fb-button”>

component
loginFB() {
Facebook.login((error, fbData) => {
if (error) {
alert("Error during login: " + error.message);
Config.isFBLoggin = false;
} else {
this.user.fbToken = fbData.token;
this.getFBDetails(fbData.token);
}
});
}


#4

I’m seeing the login-manager.dt on the plugin,

import { LoginBehavior } from “./login-behavior”;
import { FacebookAccessToken } from “./facebook-access-token”;

unfortunately on the doc I can’t find how to change the behavior in Angular TypeScript


#5

I have modified the module code directly
node_modules/nativescript-facebook

login.manager.ios.js

On Line 9
change
if (fbLoginBehavior === void 0) { fbLoginBehavior = login_behavior_1.LoginBehavior.LoginBehaviorBrowser; }

to
if (fbLoginBehavior === void 0) { fbLoginBehavior = login_behavior_1.LoginBehavior.LoginBehaviorNative; }


#6

You may pass LoginBehavior as second parameter to init method.


#7

I don’t have any init method on my component. I think I should include it inside ngOnInit method, could you paste the code? Thanks so much !!!


#8
import * as Facebook from "nativescript-facebook";

        if (Config.isIOS) {
            Facebook.init(this.config.facebookAppID, Facebook.LoginBehavior.LoginBehaviorNative);
        }