captainhaddockfr35 / nativescript-google-login

Apache License 2.0
2 stars 5 forks source link

presentingViewController must be set. #22

Open ShyshkovOleg opened 3 years ago

ShyshkovOleg commented 3 years ago

IOS ERROR: presentingViewController must be set. ANDROID ERROR: activity: undefined JS: Will request ID token JS: Starting activity for result... JS: Cancelled JS: result. provider = google onActivityResult() JS: result. code = 1 onActivityResult() JS: Calling Callback function with Results JS: ==== object dump start ==== JS: provider: "google" JS: code: "1" JS: ==== object dump end ====

@pboulch Could you please help me with this.

agardes commented 2 years ago

@ShyshkovOleg had same issue, fixed it putting the GoogleLogin.init() function inside a timeout(). Seems the function is triggered too early.

if(isIOS){
    let v =  setTimeout(()=>{
                   GoogleLogin.init({
                        google: {
                            initialize: true,
                            clientId: "-",
                            serverClientId: "",
                            isRequestAuthCode: true
                        },
                        viewController: application.ios.rootController
                    });
                clearTimeout(v)
            },500)
      }