簡體   English   中英

有沒有辦法解決我在 flutter 中升級 firebase 后遇到的問題

[英]Is there a way to solve the problem I am facing after upgrading firebase in flutter

嗨,我僅在 iOS 模擬器中運行我的應用程序時,在 flutter 上遇到錯誤。 它在 Android 模擬器中運行良好。 在我升級了我添加的 firebase 依賴項之后,我遇到了這個問題。 我之前使用的版本如下

firebase_auth: ^0.18.3
cloud_firestore: ^0.14.3
firebase_core: ^0.5.2
firebase_crashlytics: ^0.2.4

我現在使用的版本如下

firebase_auth: ^0.20.0
cloud_firestore: ^0.16.0
firebase_core: ^0.7.0
firebase_crashlytics: ^0.4.0

我得到的錯誤是

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please
    specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 12.

請注意,此問題僅在 iOS 中,而不在 Android 中,我想升級 firebase。 我在 Stackoverflow 和其他資源上嘗試了很多方法,但似乎沒有幫助。

刪除 ios 文件夾中的 2 個 pod 文件。 在終端中運行 Flutter clean 命令,然后嘗試在 iPhone 上運行該應用程序。 這經常發生在我身上,上述方法對我有用。

出現此問題是因為您尚未在 Podfile 中設置最低 ios 版本。
在 Podfile 中設置平台版本。
cd ios
nano Podfile
在文件開頭取消注釋此行
# platform:ios, '9.0'
如果您願意,可以將版本設置為 11.0,因為某些插件不再支持 9.0。
完成后,運行以下命令:

rm Podfile.lock
rm -rf Pods
pod install

此外,您可以將 Runner 中您的應用程序的最低 iOS 版本更新為您在 Podfile 中設置的版本
那應該為你做。

我嘗試了多種方法,但都失敗了,現在我為 MacBook M1 芯片用戶找到了完美的解決方案。 我們需要清除所有緩存文件並更新 pod

遵循以下步驟將是最好的

  1. 刪除 flutter 項目內 iOS 文件夾中的 .Pods 和 .symlink。

  2. 移除 Podfile.lock 移除 pubspec.lock

  3. 運行 Flutter 清潔

  4. 運行 Flutter 發布獲取

  5. 更改為 iOS 文件夾並運行

    sudo arch -x86_64 gem install ffi arch -x86_64 pod update

PS:對於M1用戶

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM