Ionic Native GooglePlus: unrecognized selector sent to instance

I am using Ionic2 with Cordova to authenticate a user in Firebase.

I can build the app and run it on iOS Simulator (Xcode). However, as soon as I try log in a user with the following code using ionic-native ("ionic-native": "2.2.11",) GooglePlus:

  loginGoogleCordova(): void {
    GooglePlus.login(['public_profile', 'email']).then(googleData => {
      let provider = firebase.auth.GoogleAuthProvider.credential(googleData.authResponse.accessToken);
      firebase.auth().signInWithCredential(provider).then((data) => {
    }, error => {
      console.error('loginGoogle: ' + error);
      this.doAlert('loginGoogle: ' + error.message);

I get the following error:

2017-03-06 07:55:06.433 theWhoZoo[10489:868996] *** WebKit discarded
an uncaught exception in the
delegate: -[__NSArrayM
objectForKeyedSubscript:]: unrecognized selector sent to instance

More Info:

I can successfully authenticate a user in a browser with AngularFire2.

  loginGoogleBrowser() {
    this.auth.login({ provider: AuthProviders.Google, method: AuthMethods.Popup }).then((data: FirebaseAuthState) => {
    }).catch((error) => {
      console.error('loginGoogle', error);
      this.doAlert('loginGoogle: ' + error.message);

Any help appreciated.

I have the same problem, have you found any solution ?

I just resolved this issue and hope it helps you as well. In Ionic’s documentation they have the example code:
.then(res => console.log(res))
.catch(err => console.error(err));

However, as of version 3.4.4, this will cause the error mentioned above. In order to correctly call the login method on the GooglePlus provider you need to pass it the ‘options’ JSON even if it’s empty. In other words by simply replacing your login call from ‘this.googlePlus.login()’ to ‘this.googlePlus.login({})’ you should get past this error.

Please report back if this resolves your issue so that I, or Ionic developers, can address this issue by either fixing the docs or overloading the login method with a version that does not require a parameter.

Update: I submitted a pull request to the ionic-native documentation repo:

1 Like

Thanks @juanjose49 it worked