Xcode - No such module 'Firebase'

Hi,
I watched Chris’ video entitled “Firebase Tutorial for iOS”. I got to five minutes into the video, and then I received the error message “No such module ‘Firebase’” when I tried to import Firebase. I tried command B, however, it failed to build. What can I do to fix this?

1 Like

Hi Sydney,

Welcome to the community!
Did you install cocoa pods correctly? (With no errors)

Hi Mikalea,
Thanks! I’m pretty new to this but I believe everything downloaded correctly. Is there a way to make sure that its installed properly?

Take out any import statement, and see if your project will build

Hi Mikaela,

This is currently what the project looks like.

Take out the import, does the project build?

Also try Cmd+ Shift + K to clean the project and then try to build it

Also what does your podfile look like?

This is what the PodFile looks like.

@sydney

Okay that’s why it isn’t working, you haven’t added any pods to this file!

Under Pods for Dalmatian
You need to add whichever pods you want, it’ll end up looking like

Pod ‘Firebase/Analytics’
Pod ‘Firebase/Database’

You should watch this video https://youtu.be/oNKVVBN2JN0

@sydney feel free to DM me on insta, I check it more and the notifications for this app aren’t great

Instagram.com/mikaelacaron

1 Like

Mikaela,
Hello! I found this question, I’m having the same problem and wondered what I could be doing differently. I followed Micah’s videos for firebase demo and I was able to connect firestore and my project. (Since the rest of the videos for that tutorial aren’t out yet I found Chris’s old tutorial and now I’m running into this problem. I don’t understand what I’m doing wrong for this demo - I’ve tried it multiple times now. My screen looks identical to hers, except in the pod file I have "Firebase/Firestore’
Anything would help, thanks!

Make sure that your pod specification looks like this in your Podfile.

pod 'Firebase/Firestore'

ie, it must be in single quotes.

If you don’t get something like this output in terminal then your pod installation may be questionable.

192-168-1-104 chrisparker 7:42:34 FirebaseDemo $ pod install
Analyzing dependencies
Downloading dependencies
Installing BoringSSL-GRPC (0.0.7)
Installing Firebase (7.10.0)
Installing FirebaseCore (7.10.0)
Installing FirebaseCoreDiagnostics (7.10.0)
Installing FirebaseFirestore (7.10.0)
Installing GoogleDataTransport (8.4.0)
Installing GoogleUtilities (7.3.1)
Installing PromisesObjC (1.2.12)
Installing abseil (0.20200225.0)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing leveldb-library (1.22.1)
Installing nanopb (2.30908.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 13 total pods installed.

[!] Automatically assigning platform `iOS` with version `14.0` on target `FirebaseDemo` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.
192-168-1-104 chrisparker 7:42:52 FirebaseDemo $

Hi everyone!

I’m having the same issue, but I don’t understand why. I tried cleaning the project with cmd shift + K. Here’s what I have:

On the terminal

(base) raphaelsaing@MacBook-Pro DatabasesModule1 % pod install
Analyzing dependencies
Downloading dependencies
Installing BoringSSL-GRPC (0.0.7)
Installing Firebase (8.5.0)
Installing FirebaseCore (8.5.0)
Installing FirebaseCoreDiagnostics (8.5.0)
Installing FirebaseFirestore (8.5.0)
Installing GoogleDataTransport (9.1.0)
Installing GoogleUtilities (7.5.0)
Installing PromisesObjC (2.0.0)
Installing abseil (0.20200225.0)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing leveldb-library (1.22.1)
Installing nanopb (2.30908.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 13 total pods installed.

[!] Automatically assigning platform `iOS` with version `14.0` on target `DatabasesModule1 (iOS)` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] Automatically assigning platform `macOS` with version `11.0` on target `DatabasesModule1 (macOS)` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

On Xcode (I made sure to use the xcworkspace file and not the xcodeproject file)

Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'DatabasesModule1 (iOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (iOS)

end

target 'DatabasesModule1 (macOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (macOS)

pod 'Firebase/Firestore'

end

If you have time to look at this for a minute thank you so much in advance! :smiley:

@CalStark

Hi Raphael,

Is this for iOSDatabase course and is this Module 1 ?

Your Podfile looks a bit different to mine. Can you tell me what version of CocoaPods you have installed?
In your terminal window type the command:

pod env

and paste the output in a reply.

Hi Chris, thank you for your reply! Yes it’s for iOS Database module 1. Here’s the terminal output:

(base) raphaelsaing@MacBook-Pro DatabasesModule1 % pod env

### Stack

CocoaPods : 1.10.2
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
RubyGems : 3.0.3
Host : macOS 11.5 (20G71)
Xcode : 12.5.1 (12E507)
Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/


### Installation Source

Executable Path: /usr/local/bin/pod


### Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-trunk : 1.5.0
cocoapods-try : 1.2.0


### Podfile

```ruby
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'DatabasesModule1 (iOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (iOS)

end

target 'DatabasesModule1 (macOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (macOS)

pod 'Firebase/Firestore'

end

Make sure pod 'Firebase/Firestore' Is indented correctly!! It shouldn’t be all the way to the left.

Hello @mikaelacaron, just tried indenting the pod like this:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'DatabasesModule1 (iOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (iOS)

end

target 'DatabasesModule1 (macOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (macOS)

  pod 'Firebase/Firestore'

end

Still having the same bug “No such module firebase” though
I re-did the pod install thing on the terminal after indenting and closed/reopened the file before testing

Hi @Chris_Parker @mikaelacaron , I think I solved it! :smiley:

My pod file was supposed to look like this:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'DatabasesModule1 (iOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (iOS)

  pod 'Firebase/Firestore'


end

target 'DatabasesModule1 (macOS)' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for DatabasesModule1 (macOS)

    pod 'Firebase/Firestore'

end

In other words, I had to type "pod ‘Firebase/Firestore’ twice, once at the top and once at the bottom, for the iOS and for the macOS parts!
Now I don’t have the ‘No such module Firebase’ error anymore

I have no idea what the difference is and what exactly happened but hey, at least it works :grin:

Thank you both for taking the time to look at my issue!

@CalStark

Yes, that makes sense. Your App is iOS so you would ignore the lower section (macOS) since that does not apply. My guess is that should be able to delete the MacOS target completely.

I have just upgraded my version of cocoaPods so I’ll create a test project and see what happens.

@CalStark

The fact that your Podfile was different to mine had me wondering why.

I now know what you’ve done when you created your App. You created it as a Multiplatform application whereas it should just be iOS.

When you create your App you need to ensure that the options for an iOS App are as per the following screenshot.

That will ensure that when you do your pod init you will get a Podfile that looks like this before you add anything to it.

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'FirebaseTest' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for FirebaseTest

end
1 Like

Ahhhhhhh I see!! Indeed I must have done that!! Thanks a lot for the heads up, I’ll be more careful about this when creating projects

1 Like