首页 > 解决方案 > 如何在 m1 上使用具有 nullsafety 的 firebase?[ 解决了 ]

问题描述

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

我已经用最新版本的 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 在 Apple Silicon (M1) 上运行 CocoaPods

标签: iosfirebasefluttercocoapods

解决方案


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

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

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

platform :ios, '9.0'

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

platform :ios, '10.0'

cocoapods 版本颤振


推荐阅读