pod lib create MyPods.dependency 'Firebase'pod install on the demo appReplaceMe.swiftInstall all pod dependencies correctly.
I want to create a single Cocoapod that I can use cross-platform across iOS, tvOS, and watchOS that share all the same business logic.
Firebase is distributed as closed source *.frameworks via cocoapods, which may have something to do with the error. However, i expected Cocoapods to be able to set everything up properly on pod install.
No such module 'Firebase' - `pod install didn't quite do the job.
CocoaPods : 1.2.0.beta.1
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
RubyGems : 2.0.14.1
Host : Mac OS X 10.11.6 (15G1108)
Xcode : 8.1 (8B62)
Git : git version 2.2.1
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ b1249ce2d1755ae4b9c01ce6d14565cbfed4ba09
Executable Path: /usr/local/bin/pod
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.1.1
cocoapods-try : 1.1.0
use_frameworks!
target 'MyPod_Example' do
pod 'MyPod', :path => '../'
target 'MyPod_Tests' do
inherit! :search_paths
end
end
See ReplaceMe.swift for the error
It looks like the Firebase pod does have a module map in it, but the podspec for Firebase isn't properly setup to use the module map using the podspec dsl here: https://guides.cocoapods.org/syntax/podspec.html#module_map.
Until the module map is properly setup for Firebase, you won't be able to have statements like import Firebase. Please contact the pod author (appears to be Google) to have this fixed. Thanks!
Any update on this ?
Alex293: I don't believe the Firebase team has released any significant iOS updates since this report. It would be worth contacting them with a link to @benasher44's comment
Correct. It appears that Firebase needs to update their podspec.
This is a real bummer. :)
I gave it another try 3.15: still no luck. I also tried to bring Firebase's team attention towards it via Twitter and their contact form on Firebase documentation but in vain so far.
Firebase's answer:
This is indeed a known issue. I've already logged a bug and we'll be exploring potential solutions regarding this matter. However, this may take awhile and unfortunately, I can't give any timeline at this moment. Feel free to check back with us for any updates or keep an eye out on our release notes.
Could Firebase's open-sourcing move help with this issue? I asked on SO.
@dirtyhenry not yet, though I think this is the same issue that causes Firebase to not import properly in unit tests. You should try the workaround in the linked issue and see if it allows you to import Firebase as you would expect.
Once you've gotten past that, you may run into issues with Firebase as a transient static dependency.
@morganchen12 thanks. I figured I would try to fork a version where I would remove the modulemap file as suggested by @benasher44 above.
I had no idea what I was doing, but it turns out this was enough to build a pod with FirebaseDev as a dependency. Any idea why the modulemap was created that way? Could i face some nasty side effects in the long run using my forked version?
UPDATE: I deleted the fork after it was merged to the firebase SDK => including the pod as a dependency works fine on the master branch now.
@dirtyhenry I'm having the same issue (No such module 'Firebase'). I downloaded your MyPod example and ran pod install to get the latest Firebase (4.0.2). I still see the error. What did you do to make it work?
$ pod --version
1.2.1
$ pod install
Analyzing dependencies
Fetching podspec for MyPod from ../
Downloading dependencies
Using Alamofire (4.4.0)
Using Firebase (4.0.2)
Using FirebaseAnalytics (4.0.1)
Using FirebaseCore (4.0.2)
Using FirebaseInstanceID (2.0.0)
Using GoogleToolboxForMac (2.1.1)
Using MyPod (0.1.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 7 total pods installed.
@dougdiego You should use the open-source version of the SDK (ie FirebaseDev) to make it work. Not sure the official one supports being used as a dependency yet.
Just tried to create a cocoapod with Firebase pod as a dependency and still getting "no such module firebase". Will try it out with the FirebaseDev version
I just tried both Firebase and FirebaseCommunity, but no success there :(
Supporting Firebase as a pod dependency is a work in progress.
In the meantime, it is possible to depend on FirebaseCommunity, with the caveat that the Firebase module is not available. Code should import the Firebase component they need specifically, like FirebaseMessaging or FirebaseDatabase.
It's also possible to depend on the official Firebase pods using the CocoaPods 1.4.0 static_framework feature.
Took me a while to find out exactly how to add static_framework feature, so I'm just going to post it here in case anyone else wants it:
s.static_framework = true
s.dependency 'Firebase'
@vauxhall Did you get this working? I just tried with CocoaPods 1.4.0.rc.1 and it didn't work.
@trein See examples in the Firebase open source repo. Specifically the podspec's in the top level directory and the Example Podfile.
My comment above from October 31st is no longer true. The Firebase open source repo is now interoperable with the official Firebase release.
@trein in case it can help you this is my podspec, it did work for me:
Pod::Spec.new do |s|
s.name = 'xxx'
s.version = '1.0.28'
s.swift_version = '4'
s.summary = 'xxx'
s.description = <<-DESC
xxx
DESC
s.homepage = 'xxx'
s.license = 'xxx'
s.author = { 'xxx' => 'xxx' }
s.source = { :git => 'xxx', :tag => s.version.to_s }
s.library = 'c++'
s.ios.vendored_frameworks = 'xxx'
s.ios.deployment_target = '9.0'
s.source_files = 'xxx/Sources/**'
s.resources = 'xxx/Resources/**'
s.static_framework = true
s.dependency 'Firebase'
s.pod_target_xcconfig = {
"ENABLE_BITCODE" => 'NO',
"OTHER_LDFLAGS" => '$(inherited) -framework "xxx"',
"SWIFT_OBJC_BRIDGING_HEADER" => '${PODS_ROOT}/xxx/Bridging.h'
}
end
Thank you both @paulb777 and @vauxhall for the helpful pointers. I finally got it working thanks to your comments. Here is what I did:
As for Firebase Core and Firebase Analytics related code, I simply replaced the import Firebase with import FirebaseCore and import FirebaseAnalytics. I also replaced spec.ios.dependency 'Firebase/Analytics', '~> 4.8' with spec.ios.dependency 'FirebaseAnalytics', '~> 4.0' in my .podspec file.
As for GoogleMobileAds related code, I kept a dependency on spec.ios.dependency 'Firebase/AdMob', '~> 4.8', but set spec.static_framework = true in my .podspec file.
All working now 👍
@trein Could you give me a little help getting GoogleMobileAds on my pod?
My pod spec has the following:
s.static_framework = true
s.dependency 'Firebase/AdMob'
When I try import GoogleMobileAds it works on the example project, but not on the ReplaceMe.swift Do I need to do something else?
@hpbl I few questions so that I can understand your setup:
How is your project organized? For the purpose of the next question, I will assume you have:
LibProject.LibProject that you own. I will refer to that as AppProject.Now, assuming the previous definitions:
LibProject project compile by itself?LibProject in AppProject (other than GoogleMobileAds), does AppProject compile?AppProject failing to compile only when you do import GoogleMobileAds?@trein thanks for the help.
LibProject does compileLibProject can be used on AppProject with no problem.AppProject can import GoogleMobileAds with no problem, but I cannot import it on LibProject which is what I want to do. I keep getting No such module 'GoogleMobileAds' error@hpbl Ok. I'm having some trouble understanding what you want to achieve. Do you want to implement some helper classes in LibProject using GoogleMobileAds? Will these helper classes be later used by your AppProject?
Also, do you have Firebase/AdMob declared in your .podspec and potentially in Podfile of your LibProject?
Yes, what I want is to create a pod which will build some functionality on top of GoogleMobileAds. And then I'll use this pod, like any other, on a project. But I can't seem to get the GoogleMobileAds as a dependency of my pod. I can access it on the Example project of the pod, but not on the pod itself.
My .podspec has the following:
s.static_framework = true
s.dependency 'Firebase/AdMob'
@hpbl Here is the setup that worked for me:
CocoaPods version: 1.4.0.rc.1
Contents of LibProject.podspec in LibProject:
Pod::Spec.new do |spec|
# More stuff above...
spec.static_framework = true
spec.ios.dependency 'FirebaseAnalytics', '~> 4.0'
spec.ios.dependency 'Firebase/AdMob', '~> 4.8'
# More stuff below...
end
Contents of Podfile in LibProject (just so that I can compile the LibProject in Xcode):
source 'https://github.com/CocoaPods/Specs.git'
swift_version = '4.0'
platform :ios, '10.0'
use_frameworks!
target 'LibProject' do
pod 'FirebaseAnalytics', '~> 4.0'
pod 'Firebase/AdMob', '~> 4.8'
# More stuff below...
end
Contents of Podfile in AppProject:
source 'https://github.com/CocoaPods/Specs.git'
swift_version = '4.0'
platform :ios, '10.0'
use_frameworks!
target 'AppProject' do
pod 'LibProject', :path => '../LibProject'
# More stuff below...
end
Here is the directory structure:
└── Apps
├── AppProject
│ ├── AppProject.xcodeproj
│ ├── AppProject.xcworkspace
│ ├── Podfile
│ └── (more files)
└── LibProject
├── LibProject.podspec
├── LibProject.xcodeproj
├── LibProject.xcworkspace
├── Podfile
└── (more files)
@trein The difference between our projects would be the the Podfile in LibProject. I created my pod using pod lib create, so my project structure is the following:

My podspec file is like yours, but I do not have 2 Podfile. And the only Podfile I have looks like this:
use_frameworks!
target 'PazAdMobViewController_Example' do
pod 'PazAdMobViewController', :path => '../'
target 'PazAdMobViewController_Tests' do
inherit! :search_paths
end
end
Again, my problem is that I can import GoogleMobileAds on PazAdMobViewController_Example but I can't on Development Pods > PazAdMobViewController > ReplaceMe.swift
@trein I was with the latest stable version of cocoaPods 1.3.1 I updated to your version 1.4.0.rc.1 ran another pod install and now everything works fine.
Thank you so much for your help,
Keep up the good work! 👍
I had some issues with this and Firebase Auth, but in the latest release of Firebase 5.x it seems to be all resolved.
In case anyone is still having problems with this, what worked for me was to use pod FirebaseRemoteConfig instead of Firebase/RemoteConfig in the Podfile and importing FirebaseCore instead of Firebase in your code. The Xcode's autocomplete might help you to see which packages are included.
Most helpful comment
Thank you both @paulb777 and @vauxhall for the helpful pointers. I finally got it working thanks to your comments. Here is what I did:
As for Firebase Core and Firebase Analytics related code, I simply replaced the
import Firebasewithimport FirebaseCoreandimport FirebaseAnalytics. I also replacedspec.ios.dependency 'Firebase/Analytics', '~> 4.8'withspec.ios.dependency 'FirebaseAnalytics', '~> 4.0'in my .podspec file.As for GoogleMobileAds related code, I kept a dependency on
spec.ios.dependency 'Firebase/AdMob', '~> 4.8', but setspec.static_framework = truein my .podspec file.All working now 👍