21

I am trying to update my Swift project to Firebase's new SDK Version 4.0.0 using CocoaPods (as suggested by the documentation) but the updated SDK does not seem to be installing even when I follow the steps in the documentation.

Can anyone help my understand why this is not working and what I can do to update to the new Firebase SDK?

My 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

When I run pod install I get this seemingly promising output (except that it is not version 4 as I think it should be):

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.

I can tell it isn't updating to the most recent SDK as well because the new firebase documentation does not match the functions that work in my project. My project is in Swift, so for example:

Works

FIRApp.configure()

Does not work (but is suggested by documentation)

FirebaseApp.configure()

I did try these solutions as well:

Rbar
  • 3,740
  • 9
  • 39
  • 69
  • What version of CocoaPods do you have?, for checking the version use the command: "pod --version". You should use the last version! – DiegoQ May 29 '17 at 15:24
  • @DiegoQ I have version 1.2.1 (good thinking though; the documentation note CocoaPods 1.0.0 or later is needed so I can see that being an issue in others' cases) – Rbar May 29 '17 at 15:33
  • Perhaps - pod repo update and retry – Paul Beusterien May 29 '17 at 15:35
  • @PaulBeusterien just tried pod repo update and reran pod install. no luck, but thanks for the suggestion anyway – Rbar May 29 '17 at 15:38
  • In the console run "pod update", then "pod install" again – DiegoQ May 29 '17 at 15:47

6 Answers6

35

There was nothing wrong with your original Podfile ;) You are just confusing pod install with pod update — you were running the former but you should be using the latter instead. A brief overview to clear things up:

pod install. When you run pod install, it only resolves dependencies for pods that are not already listed in the Podfile.lock. For pods in Podfile.lock, it downloads the explicit version listed there, without checking if a newer version is available — I believe this (expected) behavior was causing your issue.

pod update. If you run pod update, CocoaPods will update every pod listed in your Podfile to the latest version possible. Of course, respecting the version restrictions declared in your Podfile, if any.

For more information, be sure to check the pod install vs. pod update guide as well.

Paulo Mattos
  • 18,845
  • 10
  • 77
  • 85
  • @Alper Double check that your `Podfile` does *not* contain a hardcoded/explicit Firebase version (e.g., `pod 'Firebase', '3.0.5'`, etc). – Paulo Mattos Oct 27 '17 at 19:36
  • I fixed it by replacing the subspec versions of the pods `Firebase/Foo` with the full names `FirebaseFoo`. – Alper Oct 28 '17 at 07:56
19

I had a similar issue and was stuck at the following output even after running the run pod repo remove master and pod install and 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)

I kept seeing the note in the pod update command output:

[!] Google has been deprecated

So I deleted the Google from the podfile:

 pod Google

Then I re-ran:

 pod update

and Received:

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)
Jacksonsox
  • 1,114
  • 15
  • 25
  • 1
    This was my issue. I had 'GoogleAnalytics' in my podfile. When I removed this firebase updated correctly. I was then able to put 'GoogleAnalytics' back and firebase didn't downgrade. Do you know why this happens? – Simon Nov 02 '17 at 08:42
  • 1
    Worked for me. I found a critical point was removing use of 'Google' which was receiving this deprecation warning. I actually had an old pod 'Google/Analytics' in my podfile. Solved by either removing, or updating it to the newer 'GoogleAnalytics' pod. After that, all Firebase pods updated to the latest version. – Neil Smith Aug 31 '18 at 16:17
4

I had the same problem and just fixed it by changing the pod subsec into the full name of the pods like this:

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

Rather weird that this confusion happened in the first place but at least this fixes it.

Alper
  • 3,424
  • 4
  • 39
  • 45
3

Similarly to how Alamofire in my original podfile states the version I would like, doing so for firebase made it update to version 4.0.0 and the appropriate firebase functions work now.

For example:

Change (for each):

pod 'Firebase/Auth'

To:

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

A full example of my new podfile and the output after running pod install is as follows.

Correct 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

Output

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
Rbar
  • 3,740
  • 9
  • 39
  • 69
  • 1
    This can be done but is not necessary and the file would need to be updated at every new pod version release. Please check Paulo Mattos's answer: just run "pod update" if you want to keep the latest version of all pods (for which you do not specify a version) – Kqtr Sep 02 '17 at 19:07
  • It's currently working great, but I think that's not proper solution as we actually want. – Berlin May 29 '18 at 10:16
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)
Giang
  • 3,553
  • 30
  • 28
0

I have the same problem with Ionic and Capacitor too, from this instruction: https://firebase.google.com/docs/dynamic-links/custom-domains

look like you are missing the FirebaseDynamicLinkCustomDomains, you should update this to your ios project: for example, if your url is:

encodedLink = https://yourtargetlink.com (you should encode it to this https%3A%2F%2Fyourtargetlink.com)

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

You should add this key to your ios project

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

Hiep Tran
  • 3,735
  • 1
  • 21
  • 29