简体   繁体   中英

Firebase (Phone Auth) Getting iOS error: register custom URL scheme

My flutter app uses Firebase Auth (Phone). I keep seeing the error: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx' .

I have added the URL schema to the info.plist as follows, but I'm getting the same error.

在此处输入图像描述

2020-04-29 20:40:05.173962-0400 Runner[395:20944] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx' in the app's Info.plist file.'
*** First throw call stack:
(0x1889035f0 0x188625bcc 0x1887f9b28 0x10086cfa8 0x100f056a0 0x102efb3b0 0x102e921bc 0x102eeb9cc 0x102ea2a68 0x102ea4dcc 0x1888821c0 0x188881edc 0x1888815b8 0x18887c5c8 0x18887bc34 0x1929c538c 0x18c9ae22c 0x10082addc 0x188703800)
libc++abi.dylib: terminating with uncaught exception of type NSException

Delete you URL Type entry from.plist file and follow the steps, .plist entry will be automatically generated.

This works for Flutter as well

Steps:

在此处输入图像描述

You can click on + in URL Types if you want to add more than 1 URL Schemes.

Please comment if you have any questions.

Happy to help!

There is a Firebase documentation for iOS phone verification setup:

To enable the Firebase SDK to use reCAPTCHA verification:

Add custom URL schemes to your Xcode project:

  1. Open your project configuration: double-click the project name in the left tree view. Select your app from the TARGETS section, then select the Info tab, and expand the URL Types section.
  2. Click the + button, and add a URL scheme for your reversed client ID. To find this value, open the GoogleService-Info.plist configuration file, and look for the REVERSED_CLIENT_ID key. Copy the value of that key, and paste it into the URL Schemes box on the configuration page. Leave the other fields blank. When completed, your config should look something similar to the following (but with your application-specific values):

https://firebase.google.com/docs/auth/ios/phone-auth?authuser=0

Works for Flutter too.

I had the same problem. Try with the following setting.

在此处输入图像描述

My issue was I had copied the GoogleService-info.plist into the wrong directory. There is a top level folder named after your app, and a folder with the same name, inside that one. So like, MyApp/MyApp , it needs to be inside that second, inner folder.

Add the reverse client id in the url launcher.

Reverse client id is located in googleservies.infolist xcode and copy the url and paste the url in url launcher by add the link

You need to register custom URL scheme in the app's Info.plist file.

Add this line in your info.plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleIdentifier</key>
        <string></string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>enter your custom URL scheme here</string>
        </array>
    </dict>
</array>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM