Flutter ios 停留在“配置默认 Firebase 应用”

Sha*_*med 8 flutter

我现在不想要推送通知,尽管我已经添加了GoogleService-Info.plistfirebase 推送通知的文件和代码。

它适用于 android,但在 iOS 上有问题。iOS就这样卡住了。

在此处输入图片说明

小智 7

我不知道现在是否有帮助...

我在https://firebase.google.com/docs/flutter/setup找到了解决方案

它说“使用 XCode,将文件移动到 Flutter 应用程序的 Runner/Runner 目录中。”

当,我只是GoogleService-Info.plist在 VSCode 中复制并粘贴,然后执行flutter run. 它无限打印“配置默认 Firebase 应用程序”。

但,

1. Execute xcode and open {your_app}/ios
2. drag & drop `GoogleService-Info.plist` at `Runner/Runner`
3. Choose `Finish`
Run Code Online (Sandbox Code Playgroud)

这样就修复了错误。

我希望它能帮助其他有同样问题的人。


nđq*_*nđq 5

答案应可这里报价:

  1. 打开 Xcode,然后右键单击Runner目录并选择将文件添加到“Runner”。
  2. 从文件管理器中选择GoogleService-Info.plist
  3. 将出现一个对话框并要求您选择目标,选择Runner目标。
  4. 然后将下面的CFBundleURLTypes属性添加到[my_project]/ios/Runner/Info.plist文件中。
<!-- Put me in the [my_project]/ios/Runner/Info.plist file -->
<!-- Google Sign-in Section -->
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <!-- TODO Replace this value: -->
            <!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID -->
            <string>com.googleusercontent.apps.861823949799-vc35cprkp249096uujjn0vvnmcvjppkn</string>
        </array>
    </dict>
</array>
<!-- End of the Google Sign-in Section -->
Run Code Online (Sandbox Code Playgroud)