[英]Firebase (Phone Auth) Getting iOS error: register custom URL scheme
我的 flutter 應用程序使用 Firebase Auth(電話)。 我一直看到錯誤: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx'
。
我已將 URL 架構添加到 info.plist 中,如下所示,但我遇到了同樣的錯誤。
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
iOS 電話驗證設置有一個 Firebase 文檔:
要啟用 Firebase SDK 以使用 reCAPTCHA 驗證:
將自定義 URL 方案添加到您的 Xcode 項目:
- 打開您的項目配置:雙擊左側樹視圖中的項目名稱。 Select 您的應用從 TARGETS 部分,然后 select Info 選項卡,並展開 URL Types 部分。
- 單擊 + 按鈕,並為您的反向客戶端 ID 添加 URL 方案。 要查找此值,請打開 GoogleService-Info.plist 配置文件,然后查找 REVERSED_CLIENT_ID 鍵。 復制該鍵的值,並將其粘貼到配置頁面上的 URL 方案框中。 將其他字段留空。 完成后,您的配置應類似於以下內容(但使用特定於應用程序的值):
https://firebase.google.com/docs/auth/ios/phone-auth?authuser=0
也適用於 Flutter。
我的問題是我將GoogleService-info.plist
復制到了錯誤的目錄中。 有一個以您的應用程序命名的頂級文件夾,以及一個同名的文件夾,在該文件夾內。 就像MyApp/MyApp
一樣,它需要在第二個內部文件夾中。
在 url 啟動器中添加反向客戶端 ID。
Reverse client id is located in googleservies.infolist xcode and copy the url and paste the url in url launcher by add the link
您需要在應用程序的 Info.plist 文件中注冊自定義 URL 方案。
將此行添加到您的 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.