Nativescript-plugin-firebase: Login via Phone crashes app

Created on 24 Oct 2018  路  7Comments  路  Source: EddyVerbruggen/nativescript-plugin-firebase

Hello,

in my app I am trying to log user via phone, but every time I send the request, screen goes black and the app crashes.

Request looks like this:

        .login({
          type: firebase.LoginType.PHONE,
          phoneOptions: {
            phoneNumber: this.customerPhone
          }
        })
        .then(result => console.log(JSON.stringify(result)))
        .catch(err => console.error(err))

Additional info:

  • The app is on iOS platform
  • I am calling firebase.init() before (in this app I am collectiong data from firestore and it works just fine)
  • I allowed push notifications in xcode
  • I have certificates, bundle ID, provisioning profile set properly

Is there a way to get additional info on the crash report?

All 7 comments

Is phone auth enabled in the Firebase console?

Yes, Firebase console has phone auth enabled.

OK, please share the repo (or one I can clone) so I can reproduce it.

I'm having the same problem. The app crash without any error message. I've tracked down and found that it crashed in file firebase.ios.ts at line 799: verifyPhoneNumberUIDelegateCompletion
@EddyVerbruggen please test with my repo below. I've uploaded my repo at:
https://github.com/phamhuy/huyapp.git
It's working for android, but not ios. The description of this plugin says it's only working for physical devices but not simulator/emulator, but I found that it's been working for android emulators. I've been struggling to get it to work with ios for a few weeks now.

@phamhuy When I run your repo it crashes for me as well, but just below that logged message about verifyPhoneNumberUIDelegateCompletion there's this:

* Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Please register custom URL scheme 'com.googleusercontent.apps.422739635229-ibefj7fnji9lhuo00k9t08qoskf6egjd' in the app's Info.plist file.'

So I copied over my config of the demo app in this repo and the crash was gone.

I figured out my problem: I missed the reCAPTCHA step in the instruction in firebase console. The step is to add custom URL schemes. So, I've fixed the issue by adding the following to Info.plist:

<!-- Info.plist -->
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>CLIENT_REVERSED_ID</string>
        </array>
    </dict>
</array>

where CLIENT_REVERSED_ID value is copied over from GoogleService-Info.plist.

@EddyVerbruggen I think you should update the installation instruction to include this step.

Was this page helpful?
0 / 5 - 0 ratings