The only related issue I could find online was an issue report on GitHub: https://github.com/firebase/FirebaseUI-iOS/issues/128
However, there didn't seem to be any resolution.
Using FirebaseUI, I'd like to subclass FUIAuthPickerViewController so I can customize it a little. When I subclass and call FUIAuth.defaultAuthUI!.authViewController, I get the following runtime exception:
'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle
I'm new to Swift, so it's very possible I'm incorrectly subclassing FUIAuthPickerViewController, but everything I've read online points toward that not being the case.
Here's my subclass:
import UIKit
import FirebaseAuthUI
class AuthViewController: FUIAuthPickerViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
Here's my delegate:
public class AuthManager: NSObject, FUIAuthDelegate {
// TODO: Implement TOS URL
// TODO: Implement custom strings for multiple languages
static let instance = AuthManager()
private override init() {
super.init()
self.firebaseUI().delegate = self;
self.firebaseUI().providers = [FUIGoogleAuth(), FUIFacebookAuth()]
}
public func firebaseUI() -> FUIAuth {
return FUIAuth.defaultAuthUI()!
}
public func firebase() -> FIRAuth {
return FIRAuth.auth()!
}
public func addStateChangeListener(listener: @escaping FIRAuthStateDidChangeListenerBlock) {
self.firebase().addStateDidChangeListener(listener)
}
public func showLoginFrom(viewController: UIViewController) {
viewController.present(self.firebaseUI().authViewController(),
animated: true,
completion: nil)
}
// MARK: FUIAuthDelegate
public func authUI(_ authUI: FUIAuth, didSignInWith user: FIRUser?, error: Error?) {
}
public func authPickerViewController(forAuthUI authUI: FUIAuth) -> FUIAuthPickerViewController {
return AuthViewController(authUI: authUI)
}
}
If I remove the default FUIAuthPickerViewController everything works fine. I just assumed by subclass would inherit its NIB from its parent if one wasn't defined.
Any help is appreciated.
Regards, Cohen
It turns out this is a bug in FirebaseUI that has resurfaced from an older version.
The issue can be tracked here.
A temporary solution is to hardcode the correct NIB name in your
FUIAuthPickerControllersubclass:Swift:
Objective-C: