CocoaPods没有将Firebase SDK更新到4.0.0版

时间:2017-05-29 15:06:07

标签: ios swift firebase sdk cocoapods

我正在尝试使用CocoaPods(Firebase's new SDK Version 4.0.0)将我的Swift项目更新为as suggested by the documentation,但即使我按照steps in the documentation更新的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()

不起作用(but is suggested by documentation

FirebaseApp.configure()

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

6 个答案:

答案 0 :(得分:25)

您的原始版本Podfile没有任何问题;)您只是将pod installpod update混淆 - 您正在运行前者,但您应该使用后者。简要介绍清理事项:

pod install 。当您运行pod install时,会解析Podfile.lock中尚未列出的广告连播的依赖关系。对于Podfile.lock中的pod,它会下载其中列出的显式版本,而不检查是否有更新的版本 - 我相信此(预期)行为会导致您的问题。

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

有关详细信息,请务必查看pod install vs. pod update指南。

答案 1 :(得分:16)

我有一个类似的问题,即使在运行run pod repo remove masterpod install以及pod 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)

答案 2 :(得分:3)

与原始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

答案 3 :(得分:3)

我遇到了同样的问题,只是通过将pod subsec更改为pod的全名来修复它:

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

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

答案 4 :(得分:0)

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)

答案 5 :(得分:0)

根据此指令,我也对离子和电容器有同样的问题: https://firebase.google.com/docs/dynamic-links/custom-domains

好像您缺少FirebaseDynamicLinkCustomDomains,您应该将此更新到ios项目: 例如,如果您的网址是:

encodedLink = https://yourtargetlink.com(您应该将其编码为https%3A%2F%2Fyourtargetlink.com

dynamiclink = https://yourfirebasedynamiclink.com/link/?link=${encodedLink}&apn=com.example&isi=1449448875&ibi=com.example

您应该将此密钥添加到ios项目中

// Info.plist
<dict>
  <key>FirebaseDynamicLinksCustomDomains</key>
  <array>
    <string>https://yourtargetlink.com</string>
    <string>https://yourfirebasedynamiclink.com/link</string>
  </array>
</dict>