I have implemented Firebase in my iOS App using cocoa pods. The problem is when i try to configure firebase, i get this error Use of unresolved identifier 'FIRApp'. This error occurs when i use the code FIRApp.configure() in appdelegate file. Can anyone help me with this?
import UIKit
import AWSCore
import GoogleMaps
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let defaults = NSUserDefaults.standardUserDefaults()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// Use Firebase library to configure APIs
FIRApp.configure()
return true
}
}
I have followed Firebase Guide https://firebase.google.com/docs/ios/setup#initialize_firebase_in_your_app
Here is the pod file
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
use_frameworks!
target 'xxxx' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'DKChainableAnimationKit'
pod 'Charts'
pod 'JVFloatLabeledTextField'
pod 'AWSAutoScaling'
pod 'AWSCloudWatch'
pod 'AWSCognito'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSElasticLoadBalancing'
pod 'AWSKinesis'
pod 'AWSMobileAnalytics'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSimpleDB'
pod 'AWSSNS'
pod 'AWSSQS'
pod 'GoogleMaps'
pod 'Firebase'
end
Simple solution is just import firebase before this line
#ifdef FB_SONARKIT_ENABLED
Check this image below
I've Tried all the answers but after 2 hours of headache...I found this
In AppDelegate.m file, you should import firebase like #import <Firebase.h> before #ifdef FB_SONARKIT_ENABLED line.
As I understand, You probably get success on dev build because FlipperKit libraries are used for debugging and this #ifdef FB_SONARKIT_ENABLED if condition is satisfied. When you try to archive it will not be imported and the variables will be undeclared because #import <Firebase.h> remains in that if condition.
FIRApp is available in Firebase 3.x or later.
This happens when you can't update from old versions of Firebase say 2.x to 3.x. This has been already answered here- Firebase Upgrading From 2.5.1 to 3.2.1
and How to upgrade new Firebase app from exist old app?
Key is-
pod update
You need to run pod update once before installing the Firebase pod and it will install the correct version when you do it next time.
I found out what was causing the problem. I was using an older version of cocoa pods. When i updated the cocoa pods version to the latest one, the error was rectified. Thanks.
just run this.
sudo gem update cocoapods
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