Closed DannyEspina closed 4 years ago
I found a few problems with this issue:
@DannyEspina I am sorry to hear you have the issue.
The method [FIRInstallationsItem registeredInstallationWithJSONData: date:error:] is defined in an Objective C category. The implementation of the method may be not loaded if you don't have a flag -ObjC
in "Other Linker Settings" in your app target.
Could you please make sure the -ObjC
flag is present in "Other Linker Settings" in the build settings of your app target and let us know if it fixes the issue for you.
Hey @maksymmalyhin
I believe I already have -ObjC
flag in my build settings
@DannyEspina I am not able to reproduce the issue on my end so far. Could you provide a sample project where the crash happens please?
Another option to try. FirebaseInstallations
is used by Firebase/Analytics
which is a static framework. When I use the provided podfile I cannot see the -ObjC
flag in FirebaseAnalytics
pod target. It works fine for me without it, but you may try to add it manually or add something like this to your podfile:
...
post_install do |installer|
installer.pods_project.targets.each do |target|
if ['SpreadsheetView', 'IQKeyboardManagerSwift', 'NVActivityIndicatorView'].include? target.name
...
end
if ['FirebaseAnalytics'].include? target.name
target.build_configurations.each do |config|
config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -ObjC'
end
end
end
...
Please let us know the result.
@maksymmalyhin I'll see if I can somehow create a sample app. My app is currently published to the App Store and the last thing I want is to set the whole project public.
Another thing I noticed is that I can only import FirebaseCore
and not simply Firebase
as you can see in step 5 in the setup page: https://firebase.google.com/docs/ios/setup
Here's my AppDelegate
//
// AppDelegate.swift
// Loan Calculator
//
// Created by Danny Espina on 1/22/18.
// Copyright © 2018 Danny Espina. All rights reserved.
//
import UIKit
import GoogleMobileAds
import RealmSwift
import FirebaseCore
import IQKeyboardManagerSwift
let appDelegate = UIApplication.shared.delegate as! AppDelegate
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var deviceOrientation = UIInterfaceOrientationMask.portrait
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return deviceOrientation
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Use Firebase library to configure APIs.
FirebaseApp.configure()
// Initialize the Google Mobile Ads SDK.
GADMobileAds.sharedInstance().start(completionHandler: nil)
// Migrate Realm
let config = Realm.Configuration(
// Set the new schema version. This must be greater than the previously used
// version (if you've never set a schema version before, the version is 0).
schemaVersion: 8,
// Set the block which will be called automatically when opening a Realm with
// a schema version lower than the one set above
migrationBlock: { migration, oldSchemaVersion in
// We haven’t migrated anything yet, so oldSchemaVersion == 0
if (oldSchemaVersion < 1) {
// Nothing to do!
// Realm will automatically detect new properties and removed properties
// And will update the schema on disk automatically
}
})
// Tell Realm to use this new configuration object for the default Realm
Realm.Configuration.defaultConfiguration = config
// Now that we've told Realm how to handle the schema change, opening the file
// will automatically perform the migration
_ = try! Realm()
print("SDK Version: " + GADRequest.sdkVersion())
IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.toolbarTintColor = .mainThemeOrange
return true
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
var bgTask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier(rawValue: 0);
bgTask = application.beginBackgroundTask(withName:"MyBackgroundTask", expirationHandler: {() -> Void in
application.endBackgroundTask(convertToUIBackgroundTaskIdentifier(bgTask.rawValue))
bgTask = UIBackgroundTaskIdentifier.invalid
})
}
}
// Helper function inserted by Swift 4.2 migrator.
fileprivate func convertToUIBackgroundTaskIdentifier(_ input: Int) -> UIBackgroundTaskIdentifier {
return UIBackgroundTaskIdentifier(rawValue: input)
}
I also had pod 'Firebase/Core
before in my podfile. (It was mention Firebase/Core
is no longer used) So I replace it withpod 'Firebase/Analytics
but that doesn't seem to fix the issue and I still can only import FirebaseCore
Can any of this be an issue?
If not, I'll post a question on stack overflow still the issue might derive from my app. If I revert the pod update then my app works fine which is why I thought it could be a issue with the framework
@DannyEspina There must be some detail I am missing in your project configuration. When I use Cocoapods 1.8.4, Xcode 11.3 and Swift 5 with a simple app with your Podfile I can use import Firebase
.
Could you share:
Also, just another guess: may you have your Pods in a broken state for some reason? You may try pod deintegrate
to cleanup pods in your project and pod cache clean --all
to clean Cocopoads cache on your machine before running pod update
.
As for the sample project. You may try to remove all unrelated files, API keys, GoogleServices-Info.plist
, etc. from a copy of your project and send it to us. If it still has some info you don't want to share with everyone, you may send it to me directly.
Hey @maksymmalyhin, I finally fixed the issue. I had to compare the build settings from a sample project and mines and fixed some issues with my build settings.
Thanks for the help
@DannyEspina Happy to hear the issue was fixed for you! It will be great if you could post the settings you had to change. Then other people with similar problem will be able to find a solution faster.
@maksymmalyhin Not much of a change as more of setting it back where it was. Over the course of me developing my first app I believe I mess around with some of the build settings (Advice from stack overflow answers for Linker Command failed with exit code 1 errors).
I reseted Other linker flags, Framework Search Paths and Header Search paths. After that I did pod deintegrate
-> pod cache clean --all
-> pod clean
-> pod update
After this it worked finally
After updating pods my app will crashing upon start up with this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRInstallationsItem registeredInstallationWithJSONData:date:error:]: unrecognized selector sent to instance 0x2825fed40'
FIRInstallationsItem is in Firebase. How can I resolve this issue?
my Podfile: