CocoaPods没有将Firebase SDK更新到4.0.0版

我正在尝试使用CocoaPods( 正如文档中所建议的 )将我的Swift项目更新到Firebase的新SDK版本4.0.0,但是即使我按照文档中的步骤操作,似乎也没有安装更新的SDK。

任何人都可以帮助我理解为什么这不起作用以及我可以做些什么来更新到新的Firebase SDK?

我的Podfile

# Uncomment this line to define a global platform for your project platform :ios, '9.2' # Uncomment this line if you're using Swift use_frameworks! target 'myProject' do pod 'Firebase' pod 'Firebase/Auth' pod 'Firebase/Core' pod 'Firebase/Storage' pod 'Firebase/Database' pod 'Firebase/Crash' pod 'Firebase/Messaging' pod 'Alamofire', '~> 4.4' end 

当我运行pod install我得到了这个看似很有希望的输出(除了它不是版本4,因为我认为它应该是):

 Analyzing dependencies Downloading dependencies Using Alamofire (4.4.0) Installing Firebase 3.17.0 (was 3.17.0) Using FirebaseAnalytics (3.9.0) Using FirebaseAuth (3.1.1) Using FirebaseCore (3.6.0) Using FirebaseCrash (1.1.6) Using FirebaseDatabase (3.1.2) Using FirebaseInstanceID (1.0.10) Using FirebaseMessaging (1.2.3) Using FirebaseStorage (1.1.0) Using GTMSessionFetcher (1.1.9) Using GoogleToolboxForMac (2.1.1) Using Protobuf (3.3.0) Generating Pods project Integrating client project Sending stats Pod installation complete! There are 8 dependencies from the Podfile and 13 total pods installed. 

我可以告诉它也没有更新到最新的SDK,因为新的firebase文档与我项目中的函数不匹配。 我的项目是在Swift中,例如:

作品

 FIRApp.configure() 

不起作用( 但是文档建议 )

 FirebaseApp.configure() 

我也尝试过这些解决方案:

  • https://stackoverflow.com/a/38135857/4206520
  • https://stackoverflow.com/a/37365721/4206520

您的原始Podfile没有任何问题;)您只是将pod installpod update混淆 – 您运行的是前者,但您应该使用后者。 清理简要概述:

pod安装 。 运行pod install ,它解析Podfile.lock尚未列出的Podfile.lock 。 对于Podfile.lock中的Podfile.lock ,它会下载那里列出的显式版本 ,而不检查是否有更新的版本 – 我相信这种(预期的)行为导致了您的问题。

pod更新 。 如果您运行pod update ,CocoaPods会将Podfile中列出的每个pod更新为最新版本。 当然,尊重Podfile声明的版本限制(如果有)。

有关详细信息,请务必查看pod install与pod更新指南。

我有一个类似的问题,即使在运行run pod repo remove masterpod installpod update之后,仍然停留在以下输出:

 Using AmazonAd (2.2.15) Using Firebase (3.17.0) Using FirebaseAnalytics (3.9.0) Using FirebaseCore (3.6.0) Using FirebaseInstanceID (1.0.10) Using Google (3.1.0) Using Google-Mobile-Ads-SDK (7.19.1) Using GoogleToolboxForMac (2.1.1) 

我一直看到pod update命令输出中的注释:

 [!] Google has been deprecated 

所以我从podfile中删除了Google:

  pod Google 

然后我重新跑了:

  pod update 

并收到:

 Using AmazonAd (2.2.15) Installing Firebase 4.3.0 (was 3.17.0) Installing FirebaseAnalytics 4.0.4 (was 3.9.0) Installing FirebaseCore 4.0.8 (was 3.6.0) Installing FirebaseInstanceID 2.0.4 (was 1.0.10) Installing Google-Mobile-Ads-SDK 7.24.1 (was 7.19.1) Using GoogleToolboxForMac (2.1.1) Installing nanopb (0.3.8) 

与原始podfile中的Alamofire如何声明我想要的版本类似,对firebase执行此操作使其更新到版本4.0.0并且相应的firebase函数现在可以正常工作。

例如:

改变(每个):

 pod 'Firebase/Auth' 

至:

 pod 'Firebase/Auth', '~> 4.0.0' 

我的新podfile的完整示例和运行pod install后的输出如下所示。

正确的Podfile:

 # Uncomment this line to define a global platform for your project platform :ios, '9.2' # Uncomment this line if you're using Swift use_frameworks! target 'myProject' do pod 'Firebase', '~> 4.0.0' pod 'Firebase/Auth', '~> 4.0.0' pod 'Firebase/Core', '~> 4.0.0' pod 'Firebase/Storage', '~> 4.0.0' pod 'Firebase/Database', '~> 4.0.0' pod 'Firebase/Crash', '~> 4.0.0' pod 'Firebase/Messaging', '~> 4.0.0' pod 'Alamofire', '~> 4.4' end 

产量

 Analyzing dependencies Downloading dependencies Using Alamofire (4.4.0) Using Firebase (4.0.0) Using FirebaseAnalytics (4.0.0) Using FirebaseAuth (4.0.0) Using FirebaseCore (4.0.0) Using FirebaseCrash (2.0.0) Using FirebaseDatabase (4.0.0) Using FirebaseInstanceID (2.0.0) Using FirebaseMessaging (2.0.0) Using FirebaseStorage (2.0.0) Using GTMSessionFetcher (1.1.10) Using GoogleToolboxForMac (2.1.1) Using Protobuf (3.3.0) Generating Pods project Integrating client project Sending stats Pod installation complete! There are 8 dependencies from the Podfile and 13 total pods installed 

我有同样的问题,只是通过将pod subsec更改为pod的全名来修复它,如下所示:

 - pod 'Firebase/Core' - pod 'Firebase/RemoteConfig' + pod 'FirebaseCore', '4.0.9' + pod 'FirebaseRemoteConfig', '2.0.3' 

相当奇怪的是,这种混乱首先发生了,但至少可以解决这个问题。

 Podfile platform :ios, '10.0' # ignore all warnings from all pods inhibit_all_warnings! use_frameworks! def pods pod 'Firebase/Core' end Terminal pod --version 1.3.1 pod update CocoaPods 1.5.3 is available. To update use: `sudo gem install cocoapods` For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.5.3 sudo gem install cocoapods Password: Fetching: cocoapods-core-1.5.3.gem (100%) Successfully installed cocoapods-core-1.5.3 Fetching: cocoapods-deintegrate-1.0.2.gem (100%) Successfully installed cocoapods-deintegrate-1.0.2 Fetching: cocoapods-downloader-1.2.1.gem (100%) Successfully installed cocoapods-downloader-1.2.1 Fetching: molinillo-0.6.6.gem (100%) Successfully installed molinillo-0.6.6 Fetching: cocoapods-1.5.3.gem (100%) Successfully installed cocoapods-1.5.3 Parsing documentation for cocoapods-core-1.5.3 Installing ri documentation for cocoapods-core-1.5.3 Parsing documentation for cocoapods-deintegrate-1.0.2 Installing ri documentation for cocoapods-deintegrate-1.0.2 Parsing documentation for cocoapods-downloader-1.2.1 Installing ri documentation for cocoapods-downloader-1.2.1 Parsing documentation for molinillo-0.6.6 Installing ri documentation for molinillo-0.6.6 Parsing documentation for cocoapods-1.5.3 Installing ri documentation for cocoapods-1.5.3 Done installing documentation for cocoapods-core, cocoapods-deintegrate, cocoapods-downloader, molinillo, cocoapods after 8 seconds 5 gems installed pod install Installing Firebase (5.5.0) Installing FirebaseAnalytics (5.1.0) Installing FirebaseCore (5.1.0) Installing FirebaseInstanceID (3.2.0) Installing GoogleAppMeasurement (5.1.0) Installing GoogleUtilities (5.2.2) Installing nanopb (0.3.8)