[英]Flutter Firebase app runs fine in simulator but crashes when tested in testflight
最近我加入了一個使用 firebase 的 flutter 應用程序項目,一切都很好,直到進行生產構建。 對於Android,它工作正常。 但是對於ios,我面臨一個問題,它在模擬器中運行沒有問題,但是當我將它上傳到Testflight讓我的同事測試它時,它在打開時立即崩潰。
那是我的顫振醫生 -v:
[✓] Flutter (Channel unknown, 2.2.2, on macOS 11.2.3 20D91 darwin-x64, locale
pt-BR)
• Flutter version 2.2.2 at /Users/leonardofelix/flutter
• Framework revision d79295af24 (4 months ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/leonardofelix/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
! Some Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.61.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.27.0
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • 94BE45CC-ED04-4892-B3A6-3F43D0A147AD • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• Chrome (web) • chrome •
web-javascript • Google Chrome 94.0.4606.81
以及 testflight 測試人員發給我的崩潰報告:
我已經測試了一些我在谷歌搜索中發現的東西,比如使用 xcode 再次添加 Google-Services.plist 並驗證存檔的架構是否指向發布模式。 但他們都沒有工作。
如果需要任何其他數據,我很樂意提供。 所以在此先感謝您的幫助。
好吧,我在這里找到了錯誤。 我使用 git 更改了 flutter 版本(因此 flutter 文件夾是一個 git 存儲庫),當我更改版本時,它從另一個 flutter 版本中保留了緩存,並且該緩存導致了問題。
幫助我發現這一點的事情是使用 xcode 在物理設備中運行發布版本,它提示我以下錯誤:
Error while initializing the Dart VM: Wrong full snapshot version, expected '9cf77f4405212c45daf608e1cd646852' found 'e4a09dbf2bb120fe4674e0576617a0dc'
為此,我在網上找到了一個解決方案。 我所做的是刪除 /bin 中的文件夾緩存並在 flutter 目錄中運行以下命令:
git reset --hard
git clean -xffd
flutter doctor
然后轉到我的 flutter 項目文件夾,運行flutter clean
然后flutter build ios
。
所以項目構建成功,應用程序在 ios 中運行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.