Firebase for iOS is an Objective-C framework which recommends integration using Cocoapods. Here's how I'm trying to set it up:
I am running Xcode 8b6 on OS X 10.11.6. The app is being built with the iOS 10 SDK, targeting iOS 9.
MyApp
is the regular (Swift) iOS app I want to use.
MyFramework
is an embedded dynamic framework with the app, q. I would like all the Firebase code to be abstracted away into the framework, and therefore add Firebase to the MyFramework
target in my Podfile
:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp' do
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
end
On running pod install
, I am able to import Firebase in all .swift
files in MyFramework
. However, on using import MyFramework
anywhere in my app, I get the error Missing required module Firebase
.
Thinking this could be a Cocoapods issue, I started a fresh project and integrated Firebase manually, but ended up with the same issue. Is this a known issue? If so, are there any fixes for it?
CocoaPods is not required for Swift Package Manager users. For Firebase versions 8 and higher, Swift Package Manager is the recommended installation method.
Go to the Firebase console. In the center of the project overview page, click the iOS+ icon to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options. Enter your app's bundle ID in the bundle ID field.
Firebase is a mobile backend-as-a-service that provides powerful features for building mobile apps. Firebase has three core services: Realtime database. User authentication. Hosting.
In the podspec of MyFramework, add dependency of the Firebase pods. Also set the static framework flag as true
. This is how your podspec should look:
*OTHER METADATA RELATED TO MYFRAMEWORK*
s.static_framework = true
s.dependency 'Firebase'
s.dependency 'Firebase/Database'
s.dependency 'Firebase/Auth'`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With