This is the error:
2017-11-08 21:56:14.897695-0200 htchhkr-development[4861:265024] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The default FIRApp instance must be configured before the default FIRAuthinstance can be initialized. One way to ensure that is to call `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) in the App Delegate's `application:didFinishLaunchingWithOptions:` (`application(_:didFinishLaunchingWithOptions:)` in Swift).'
This is where it loads:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
FirebaseApp use to be FIRApp, but Swift told me gently that it's no longer called FIRApp, but rather FirebaseApp. I renamed, but now I get that error.
What to do here?
I was having this same problem. I migrated to swift 4 and ran my program and got the same error. I then ran pod update in terminal and that seemed to fix my problem.
Related
I am developing an App that uses Firestore. The app runs fine on the Xcode simulator, but crashes when I try to run it on my phone. I get the following error message:
*** Terminating app due to uncaught exception 'FIRIllegalStateException', reason: 'Failed to get FirebaseApp
instance. Please call FirebaseApp.configure() before using Firestore'
I do call FirebaseApp.configure() in the didFinishLaunchingWithOptions:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
I don't understand why it would run in the simulator and not on my phone. Any help would be appreciated.
Check your podfile for how you add the firebase cocoapods, It should be like this,
pod 'FirebaseCore'
pod 'Firebase/Messaging'
If your podfile different ,please remove old firebase related pods,insert this and install.
I discovered, on a Japanese code forum, what to do. I added the following code to the AppDelegate.swift file:
var window: UIWindow?
override init() { //初期化メソッドを追記
FirebaseApp.configure()
}
The app now runs both in the simulator and on my iPhone.
Firebase.configure causes crash on App delegate file once I run, showing the following next to app delegate class
Thread 1: signal SIGABRT
In console, it shows :
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Any help please?
Note: I have Google .plist file on the project , and the right one ( I tried several times in like 8 or 10 project till now, no success)
Pod installed :
Installing Firebase (4.3.0)
Installing FirebaseAnalytics (4.0.4)
Installing FirebaseCore (4.0.8)
Installing FirebaseInstanceID (2.0.4)
..
Code :
import UIKit
import Firebase
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
Please help me out, I really need it and it's been 2 days and like 12 hours infront of xCode
This issue seems to be happening when 'GoogleService-Info.plist' file is missing within your project path. Delete the existing 'GoogleService-Info.plist'. Download again from the Firebase service, and add the '.plist' File, make sure you select the correct project target. Once added, clean and build again.
Set the target membership for the plist file
select GoogleSErvice-Info.plist in the Xcode project navigator
then enable the target membership for the file in the utilities pane for File Inspector
I had the same issue, although the GoogleService-Info(1).plist file was already present in my Xcode project.
In my case, I had already an GoogleService-Info.plist file in my Downloads directory, from a previous project. Because of that, the next file had been automatically named "GoogleService-Info(1).plist" ...and this is how I've imported in Xcode.
Because of this minor renaming of the file, I've spend more than 1 hour not knowing why on earth my app crashes!
Make sure your Google.plist file has the right name, which is: GoogleService-Info.plist
Make sure that you have "GoogleService-Info.plist" is present within your project
replace FirebaseApp.configure() with Firebase.FirebaseApp.configure()
I am working on an iPad app that does not use a .storyboard interface. My AppDelegate has the following code (in Xcode 8.2.1):
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = MyViewController()
return true
}
I've cleared the Main Interface field from the target as shown below:
However, upon running the app, I receive the following crash message:
Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: 'Could not find a storyboard
named 'Main' in bundle NSBundle
It seems that upon Building/Running the app, the Main Interface field is automatically repopulated with "Main". I've been able to remove this on universal apps, but this is my first, and unsuccessful attempt with an iPad only project. I've tried both pressing Return on the keyboard and clicking outside the field in hopes of saving my Main Interface text field changes, but still have the same result.
My question is: How can I remove the Main Interface from the target and thus avoid this error message?
Check your Info.plist. There should be an entry for the Main storyboard file base name. Delete it there and you should be good to go!
I followed all the steps correctly to install Firebase to my iOS App and it still doesn't work. In the application method, I added FIRApp.configure() like so:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
FIRApp.configure()
return true
}
And I keep receiving NSException errors. Firebase seems to work on my Android Project, what's the deal with iOS?
I believe this is some sort of Swift 3 issue, because I encountered a similar problem. After looking over the internet, I believe that Firebase 3 hasn't updated to recent Swift Syntax located in Swift 3. Many other developers are having trouble with it as well. As an alternative, you could switch back from Xcode 8 and into 7, which would allow you to create your application which will work with current IOS, and when Firebase updates, it will be easy for you to migrate to Swift 3.
Hope this helps,
Morgan Gallant
I installed XCode 7.1 and 7.2 to update my app for iOS 9.1 and 9.2 respectively, but each time I run the app on simulators or devices the app crashes on the AppDelegate's class declaration as shown below. However, I have also XCode 7.0 and when I run my app on iOS 9.0 it works fine without any issue !.
The problem even if I compile the app for iOS 9.0 it would crashes on any device running iOS 9.1 or 9.2, I tried to change the initial view controller to be a simple plain one but it seems that it never reaches the point of loading view controllers and never reaches the beginning of func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool.
It seems that Apple did something with iOS 9.1 & 9.2. The app is written in swift, I enabled NSZombie and breakpoints to catch exceptions but I get no clue from the logs.
Debug Navigator:-
AppDelegate Class Declaration
That happens to me almost every time in new versions of Xcode/Swift/iOS. When I have had this problem I have erased that line and written it again.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
This happens when you have not set you variable types correctly. Check how you declare them. In my case i was trying to access a Bool as UIColor.
I've generally had this happen when there is a storyboard problem. For example, an error in:
storyboard.instantiateController(withIdentifier: "FooView")
Try putting breakpoints around controllers that are being loaded around where you are crashing to see if that's the problem.