【问题标题】:how to work with firebase with nullsafety on m1? [ solved ]如何在 m1 上使用具有 nullsafety 的 firebase? [ 解决了 ]
【发布时间】:2021-10-26 03:02:28
【问题描述】:

编辑:此时已解决,只是使用最新版本

我已经使用最新版本的 firebase 进行了测试。我得到了这个 CocoaPods 找不到 pod "Firebase/Firestore" 的兼容版本:

  # nullsafety # not work #solved
  firebase_core: ^1.5.0   #solved now ^1.6.0
  firebase_auth: ^3.0.2   #solved now ^3.1.0
  cloud_firestore: ^2.5.0 #solved now ^2.5.1
                          #solved now firebase_storage: ^10.0.3

  # non nullsafety # work
  # firebase_core: ^0.4.0+9
  # firebase_auth: ^0.14.0+5
  # cloud_firestore: ^0.12.9+5

我的引擎:

  1. ➜ ios git:(master) ✗ ruby --version ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
  2. ➜ ios git:(master) ✗ gem --version 3.0.3

我已经尝试过这些步骤

➜  flash-chat-flutter git:(master) ✗ flutter clean
Cleaning Xcode workspace...                                         4.4s
....
➜  ios git:(master) ✗ pod cache clean --all
➜  ios git:(master) ✗ pod deintegrate
Deintegrating `Runner.xcodeproj`
Deleted 1 'Check Pods Manifest.lock' build phases.
....
Deleted 1 empty `Frameworks` groups from project.
Removing `Pods` directory.

Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
➜  ios git:(master) ✗ sudo arch -x86_64 gem install ffi
Password:
Building native extensions. This could take a while...
Successfully installed ffi-1.15.3
Parsing documentation for ffi-1.15.3
Done installing documentation for ffi after 3 seconds
1 gem installed
➜  ios git:(master) ✗ sudo gem install cocoapods --pre
....
Fetching xcodeproj-1.21.0.gem
....
Successfully installed cocoapods-1.11.0.rc.1
Parsing documentation for addressable-2.8.0
Installing ri documentation for addressable-2.8.0
....
Done installing documentation for addressable, cocoapods-core, molinillo, xcodeproj, cocoapods after 2 seconds
5 gems installed

我在这一步遇到了问题 ...

➜  ios git:(master) ✗ arch -x86_64 pod update
Update all pods
Updating local specs repositories
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "cloud_firestore":
  In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)

Specs satisfying the `cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)` dependency were found, but they required a higher minimum deployment target.

[!] Automatically assigning platform `iOS` with version `8.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`.
➜  ios git:(master) ✗ arch -x86_64 pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '8.5.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
  In snapshot (Podfile.lock):
    Firebase/Firestore (= 6.34.0, ~> 6.0)

  In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 2.5.0, which depends on
      Firebase/Firestore (= 8.5.0)


You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * changed the constraints of dependency `Firebase/Firestore` inside your development pod `cloud_firestore`.
   You should run `pod update Firebase/Firestore` to apply changes you've made.

[!] Automatically assigning platform `iOS` with version `8.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`.

我也遵循这些步骤并且仅使用非 nullsafety Running CocoaPods on Apple Silicon (M1)

【问题讨论】:

    标签: ios firebase flutter cocoapods


    【解决方案1】:

    好吧,我绝不是 M1 方面的专家,但在让 iOS 和 Android 构建与 Flutter 一起工作后,我可以在这里分享一些决定性的时刻:

    • 意识到需要 Rosetta,即使在硅芯片上(我将它与 Xcode 一起安装)。

    • sudo arch -x86_64 gem install ffi 和 sudo arch -x86_64 gem install cocoapods 为我工作...无需从 Rosetta 终端安装。 如果您需要清理现有安装,请使用 Google“gem list --local | grep cocoapods”。

    • 关于安卓。安装了北极狐(2020.3.1),即使这也包括java,我发现我也必须安装java。我从 Oracle 安装了 java(版本 11 (11.0.12),与北极狐使用相同)。

    • 发现 iOS 构建仅适用于 Flutter beta 通道(撰写本文时为 Flutter 2.5.0-5.2.pre)。

    • 意识到从 pubspec.yaml 添加或删除包可以f#*k 建立一个工作设置。发生这种情况时,即使是 Flutter clean 也无法解决问题。发现只是转储我的项目文件夹,然后使用 git 重新加载源文件将使事情再次正常运行(我确保不在我的 git 中包含任何与 pod 相关的文件)。

    • 发现 Firebase 软件包需要 iOS 10 或更高版本。我在 Xcode 中打开了 Runner.xcworkspace 并将 iOS 部署目标设置为 10。

    在某一时刻一切正常,但目前 iOS 模拟器无法正常工作。 iOS 只能通过 USB 在我的 iPad 上运行。

    在我的设置中运行的 Firebase 版本:

    • firebase_core:^1.4.0
    • firebase_storage:^10.0.1
    • cloud_firestore: ^2.4.0
    • firebase_auth:^3.0.2

    【讨论】:

    • 是的,同样具有决定性。但我使用 zulu jdk arm64 而不是 java。所以结论环境:sdk: ">=2.12.0
    【解决方案2】:

    转到您的项目的ios/pods/Local Podspaces

    然后检查那里的所有.json 文件以找到我的情况下的最后一个版本是"ios": "10.0"

    然后转到ios/Podfile并取消顶部版本的注释

    platform :ios, '9.0'
    

    并将其更改为最新版本,在我的情况下是:

    platform :ios, '10.0'
    

    cocoapods version flutter

    【讨论】:

      猜你喜欢
      • 2022-01-07
      • 1970-01-01
      • 2021-06-20
      • 2020-04-25
      • 2021-06-23
      • 1970-01-01
      • 2022-11-14
      • 2019-11-05
      • 2020-05-06
      相关资源
      最近更新 更多