Sorry to be back here so soon after you were so quick on the turnaround with the other issue I posted earlier.
Now that 0.5.4 will build correctly, I get an exception about the bundle not being able to open the NIB file "FIRAuthPickerViewController" at runtime when FIRAuthUI.authViewController() is called.
Code below fails at runtime. This happens in my own project, but I see that it also happens in the sample code in this repo, so I'll reference that. Start the uidemo project, select the Auth demo, hit Start, and it'll crash immediately.
The code compiles and runs, but it throws an exception at runtime during the call to authUI!.authViewController().
Here is the barf at runtime:
2016-09-12 17:08:00.576 uidemo[6783:3230924] ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'FIRAuthPickerViewController''
** First throw call stack:
(0x18333adb0 0x18299ff80 0x18333acf8 0x1889733a4 0x188815230 0x1885da118 0x1885a8ea4 0x18849c8ec 0x18849c844 0x100093b40 0x1000967d4 0x10009bdc8 0x10002426c 0x10002455c 0x1884d4be8 0x1884d4b64 0x1884bc870 0x1884d4454 0x1884d4084 0x1884ccc20 0x18849d04c 0x18849b628 0x1832f109c 0x1832f0b30 0x1832ee830 0x183218c50 0x184b00088 0x188506088 0x100032430 0x182db68b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
The function to successfully return the ViewController.
same issue in demo.
Um. I can't sure that it could be initWithNibName:bundle: method issues.
To test it, I did change FIRAuthUIBaseViewController code a little bit using dev_pod,
the auth demo has no issues.
Does we need to change source code?
Is it another issue about configuring frameworks?
// 'FIRAuthUIBaseViewController.h'
- (instancetype)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
authUI:(FIRAuthUI *)authUI {
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"FIRAuthPickerViewController" ofType:@"nib"];
NSBundle *bundle = [NSBundle bundleWithPath:bundlePath];
self = [super initWithNibName:bundlePath bundle:bundle];
Hm, interesting. But it seems like the problem might actually be in the code that calls this base class function: https://github.com/firebase/FirebaseUI-iOS/blob/070ad199730d467eacd96aeaec773082a1cc81d8/FirebaseAuthUI/FIRAuthPickerViewController.m#L64
Hi, I am having the same issue as davidsantiago.
Objective C or Swift: Objective C
iOS version: 9.3.5
Firebase SDK version: 3.5.2
FirebaseUI version: 0.5.4
CocoaPods Version: 1.1.0-rc1
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle ... (loaded)' with name 'FIRAuthPickerViewController''
** First throw call stack:
(0x2330791b 0x22aa2e17 0x23307861 0x27d36761 0x27be9aa3 0x279bcffb 0x2798d177 0x27882a1f 0x27882971 0x1f58cd 0x1f7fe1 0x1fcb2f 0xa4f29 0x27882a1f 0x27882971 0x27889639 0x27886b3d 0x278fba5d 0x93045 0x278f7785 0x27b1f2d1 0x27b23285 0x27b3783d 0x27b207b3 0x249aac07 0x249aaab9 0x249aadb9 0x232c9dff 0x232c99ed 0x232c7d5b 0x23217229 0x23217015 0x278f0c3d 0x278eb189 0xf6d3d 0x22ebf873)
libc++abi.dylib: terminating with uncaught exception of type NSException
This is a podspec issue, fix coming soon 馃憤
This should be fixed in 0.5.5
This issue still seems to exist. I'm using 'FirebaseUI/Auth', '~> 1.0', any suggestions?
@newPrimitives your issue is likely slightly different from this one. Can you post the stack trace here?
@morganchen12 It might be that I made a mistake in the migration, I inherited the code 3 days ago. Here is the stack trace:
2016-12-02 19:09:25.849 OneCoworking[24112:831553] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/nermin/Library/Developer/CoreSimulator/Devices/E5CCA957-2AC1-438F-9C52-4C95886B564E/data/Containers/Bundle/Application/4D4A6DDF-CCBA-4345-9140-E00956962D10/OneCoworking.app> (loaded)' with name 'One_Coworking.CustomFIRAuthPickerViewController''
*** First throw call stack:
(
0 CoreFoundation 0x000000010f4e334b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010edc621e objc_exception_throw + 48
2 CoreFoundation 0x000000010f54c265 +[NSException raise:format:] + 197
3 UIKit 0x000000010feedbd2 -[UINib instantiateWithOwner:options:] + 507
4 UIKit 0x000000010fc81c21 -[UIViewController _loadViewFromNibNamed:bundle:] + 386
5 UIKit 0x000000010fc82543 -[UIViewController loadView] + 177
6 UIKit 0x000000010fc82878 -[UIViewController loadViewIfRequired] + 201
7 UIKit 0x000000010fc830cc -[UIViewController view] + 27
8 OneCoworking 0x000000010a9f7bda -[FUIAuthBaseViewController initWithNibName:bundle:authUI:] + 553
9 OneCoworking 0x000000010a9fb1b4 -[FUIAuthPickerViewController initWithNibName:bundle:authUI:] + 89
10 OneCoworking 0x000000010a955fe6 _TFC13One_Coworking33CustomFIRAuthPickerViewControllercfT7nibNameGSqSS_6bundleGSqCSo6Bundle_6authUICSo7FUIAuth_S0_ + 358
11 OneCoworking 0x000000010a9561bf _TToFC13One_Coworking33CustomFIRAuthPickerViewControllercfT7nibNameGSqSS_6bundleGSqCSo6Bundle_6authUICSo7FUIAuth_S0_ + 207
12 OneCoworking 0x000000010a9fb12d -[FUIAuthPickerViewController initWithAuthUI:] + 121
13 OneCoworking 0x000000010a894524 _TTOFCSo27FUIAuthPickerViewControllercfT6authUICSo7FUIAuth_S_ + 36
14 OneCoworking 0x000000010a89415c _TFCSo27FUIAuthPickerViewControllerCfT6authUICSo7FUIAuth_S_ + 76
15 OneCoworking 0x000000010a8940e7 _TFC13One_Coworking23FirebaseLoginController24authPickerViewControllerfT9forAuthUICSo7FUIAuth_CSo27FUIAuthPickerViewController + 55
16 OneCoworking 0x000000010a8941aa _TToFC13One_Coworking23FirebaseLoginController24authPickerViewControllerfT9forAuthUICSo7FUIAuth_CSo27FUIAuthPickerViewController + 58
17 OneCoworking 0x000000010aa011f6 -[FUIAuth authViewController] + 267
18 OneCoworking 0x000000010a893e4d _TFC13One_Coworking23FirebaseLoginController26createSignInViewControllerfT_GSqCSo16UIViewController_ + 525
19 OneCoworking 0x000000010a91358b _TFC13One_Coworking18AuthFlowController17connectToFirebasefT_T_ + 59
20 OneCoworking 0x000000010a9113d6 _TFC13One_Coworking18AuthFlowController3actfT_T_ + 230
21 OneCoworking 0x000000010a910b15 _TFFC13One_Coworking18AuthFlowControllercFT18rootViewControllerCSo16UIViewController_S0_U_FTCSo7FIRAuthGSqCSo7FIRUser__T_ + 133
22 OneCoworking 0x000000010a8929d3 _TTRXFo_oCSo7FIRAuthoGSqCSo7FIRUser___XFo_iTS_GSqS0____iT__ + 35
23 OneCoworking 0x000000010a910ea1 _TPA__TTRXFo_oCSo7FIRAuthoGSqCSo7FIRUser___XFo_iTS_GSqS0____iT__ + 81
24 OneCoworking 0x000000010a892597 _TTRXFo_iTCSo7FIRAuthGSqCSo7FIRUser___iT__XFo_oS_oGSqS0____ + 39
25 OneCoworking 0x000000010a892681 _TTRXFo_oCSo7FIRAuthoGSqCSo7FIRUser___XFdCb_dS_dGSqS0____ + 81
26 OneCoworking 0x000000010a9e4059 __41-[FIRAuth addAuthStateDidChangeListener:]_block_invoke.275 + 58
27 libdispatch.dylib 0x0000000111ff2980 _dispatch_call_block_and_release + 12
28 libdispatch.dylib 0x000000011201c0cd _dispatch_client_callout + 8
29 libdispatch.dylib 0x0000000111ffc8d6 _dispatch_main_queue_callback_4CF + 406
30 CoreFoundation 0x000000010f4a74f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
31 CoreFoundation 0x000000010f46cf8d __CFRunLoopRun + 2205
32 CoreFoundation 0x000000010f46c494 CFRunLoopRunSpecific + 420
33 GraphicsServices 0x0000000113d95a6f GSEventRunModal + 161
34 UIKit 0x000000010fae1964 UIApplicationMain + 159
35 OneCoworking 0x000000010a92d28f main + 111
36 libdyld.dylib 0x000000011206868d start + 1
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Objective C or Swift: Swift
iOS version: 9.3.5
Firebase SDK version: 3.10.0
FirebaseUI version: 1.0.0
CocoaPods Version: 1.1.1
This is the code implementation which causes the app to crash:
authUI!.providers = authConfiguration.signInProviders
return authUI!.authViewController()
Array of providers only has Facebook.
It looks like you've overwritten the default controller to expect a different nib which isn't provided by Firebase.
... with name 'One_Coworking.CustomFIRAuthPickerViewController'
I just noticed, makes sense. Thank you for pointing this out. I just don't understand how the application worked on Swift 2? Where there some drastic changes in the library?
Yeah, we've made a great deal of changes since then. This could be better documented IMO.
I'm running into the same issue as @newPrimitives -- Is there some code we need to add to our FUIAuthPickerViewController subclasses in order to point to the correct NIB file?
My subclass only consists of an overridden viewDidLoad with a call to super.viewDidLoad(). All full explanation (with code) of my problem can be found here.
After pod update, I ran into this issue again.
As a workaround I've override
- (instancetype)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
authUI:(FUIAuth *)authUI;
from Super "FUIAuthPickerViewController" into my own "CustomAuthPickerViewController" and hardcoded the @"FUIAuthPickerViewController" NibName.
@implementation CustomAuthPickerViewController
...
- (instancetype)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil
authUI:(FUIAuth *)authUI {
self = [super initWithNibName:@"FUIAuthPickerViewController"
bundle:nibBundleOrNil
authUI:authUI];
if (self) {
self.title = @"Your Title";
}
return self;
}
...
@end
Ah, so it appears to be a bug, then.
The default implementation, uses NSStringFromClass([self class]), which I guess returns the subclass name rather than the superclass name.
I am unable to tell from the history if this was a recent change, however.
@wjuniorgit Thanks for the tip. I thought I tried that, but I don't think I was quite doing it right. I'm new to Swift and still getting used to the different syntax, but I'll try it again ASAP.
Ah, yeah, we should fix that.
For anyone interested, a temporary solution for Swift:
import UIKit
import FirebaseAuthUI
class AuthViewController: FUIAuthPickerViewController {
override init(nibName: String?, bundle: Bundle?, authUI: FUIAuth) {
super.init(nibName: "FUIAuthPickerViewController", bundle: bundle, authUI: authUI)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
Why not to use next method?
- (FUIAuthPickerViewController *)authPickerViewControllerForAuthUI:(FUIAuth *)authUI {
return [[FUICustomAuthPickerViewController alloc]
initWithNibName:NSStringFromClass([FUIAuthPickerViewController class])
bundle:[NSBundle bundleForClass:[FUIAuthPickerViewController class]]
authUI:authUI];
}
I tried using a custom picker again after a while and I see that on selecting "Sign in with email" the navigation bar buttons (Cancel, Next) are still missing from the next screen. I mainly wanted to use a custom picker in order to use my own background image and remove the "Welcome" label on the main login screen only. Is there an easy way to do just these and leave the other functionality intact?
@yorgosg The "Sign in with email" screen is showing both the "Back" and "Next" buttons for me after subclassing FUIAuthPickerViewController using the code above.
In your version, is the navigation bar still showing (and the buttons are just missing)?
@cohenadair thanks a million. It turns out I was removing the navigation bar, because I think I had to on the previous implementation of FirebaseUI. It now all works.
Only one more thing: Is there a way to get rid of the "Welcome" label? I found a FirebaseAuthUI.strings file, where you can change "Welcome" to something else, but I don't know how to change its color or remove it altogether.
Thank you!!
@yorgosg Well normally, setting the view controller's title property in viewDidLoad would be enough, but that doesn't work in this case. FUIAuthPickerViewController sets the controller's title in init(nubName:bundle:authUI:), which is called _after_ viewDidLoad, overriding the title you set.
Since when this issue is resolved there will be no need to override init(nubName:bundle:authUI:) method, the solution to change the title is to override viewWillAppear(animated:):
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.title = ""
}
@cohenadair this worked! thanks!
@cohenadair I really appreciate your help so far. I have two more issues on the custom picker:
1) On using custom strings (I read your comment here: https://github.com/firebase/FirebaseUI-iOS/issues/125#issuecomment-268527162):
I've been trying to make my strings appear, but for some reason only the strings for the FirebaseAuthUI.strings are loaded correctly, so the one replacing the one on the "Sign in with email" button.
What I did is add the following four files into a FirebaseSignUp.bundle with different strings. The files in the bundle are (under a en.lproj folder):
FirebaseAuthUI.strings
FirebaseFacebookAuthUI.strings
FirebaseGoogleAuthUI.strings
FirebaseTwitterAuthUI.strings
In my code, when I want the sign up picker with my custom strings to be displayed, I do the following:
NSString *firebaseCustomStringsFilePath = [[NSBundle mainBundle] pathForResource:@"FirebaseSignUp"
ofType:@"bundle"];
authUI.customStringsBundle = [NSBundle bundleWithPath:firebaseCustomStringsFilePath];
and when I want the sign in picker to appear, I do the following:
authUI.customStringsBundle = [NSBundle mainBundle];
2) I am trying to set the status bar colour to white, but I can't get it to work. I'm using the following standard code in my custom view controller:
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
Any ideas?
@yorgosg Sorry, I am not able to get custom string resources to work, either. I would post a question on Stack Overflow if you haven't already.
As for the status bar, see this post if your ViewController is embedded in a UINavigationController, and this one if it is not.
If those don't work, posting another question on Stack Overflow will likely be beneficial. If you have any other questions for me, feel free to email me (my email is in my profile), so we aren't cluttering this issue with off-topic discussion. :)
@yorgosg
UINavigationController *controller = [self.authUI authViewController];
controller.navigationBar.barStyle = UIBarStyleBlack;[self presentViewController:controller animated:YES completion:nil];
FWIW, using @cohenadair's approach, I was able to use a custom XIB alongside my custom view controller, like so:
[...]
super.init(nibName: "CustomAuthViewController", bundle: bundle, authUI: authUI)
[...]
It appears that the default FUIAuthViewController code is generating a nib name with the module prepended, e.g. my_target_module.CustomAuthViewController, which crashes vs. the working CustomAuthViewController.
@jwhitley please use next method for custom controllers:
func authPickerViewController(forAuthUI authUI: FUIAuth) -> FUIAuthPickerViewController {
return FUICustomAuthPickerViewController(nibName: "FUICustomAuthPickerViewController",
bundle: Bundle.main,
authUI: authUI)
}
I don't understand why this is closed, sorry. I was able to repro it in the FirebaseUI-demo-swift project just by going to Auth -> Sign In.
Objective C or Swift: Swift
iOS version: 10.3.2
Firebase SDK version: 4.0.0
FirebaseUI version: master (commit 347e8173ff8b866a2e54e4a63eb1af4111e4edb0)
CocoaPods Version: 1.3.0.beta.1
Xcode version: 8.3.3
I've done the bare minimum to get the sample project to build, haven't touched any code as such.
2017-06-17 22:01:32.882647+0100 FirebaseUI-demo-swift[266:24020] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'FUIAuthPickerViewController''
* First throw call stack:
(0x1deafb3d 0x1d137067 0x1deafa85 0x235aa7c7 0x23428eff 0x23207e6b 0x230daf63 0x230daea1 0x19bba7 0x1a0ccb 0x1a0c63 0x1a7e9f 0xe7638 0xe80d8 0x2310f785 0x2327a0ef 0x2310f785 0x2310f719 0x230f9d49 0x230f9e71 0x2310f055 0x2366133b 0x2365dc53 0x1de6b803 0x1de69a55 0x1de6a017 0x1ddbd1af 0x1ddbcfd1 0x1f567b41 0x2313ee13 0x114cf8 0x1d5aa4eb)
libc++abi.dylib: terminating with uncaught exception of type NSException
Hi have the same error
MantoApp[65711:1867445] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'FUIAuthPickerViewController''
@eliotstock you solved the problem?
@eliotstock @freedoom1984 I can confirm issue.
It was fixed in Firebase-UI 4.1.1
Please re-open ticket next time if you have any issues.
@yorgosg Well normally, setting the view controller's
titleproperty inviewDidLoadwould be enough, but that doesn't work in this case.FUIAuthPickerViewControllersets the controller's title ininit(nubName:bundle:authUI:), which is called _after_viewDidLoad, overriding the title you set.Since when this issue is resolved there will be no need to override
init(nubName:bundle:authUI:)method, the solution to change the title is to overrideviewWillAppear(animated:):override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.title = "" }
Mine doesn't work. Welcome label still there :( any thoughts?
Most helpful comment
For anyone interested, a temporary solution for Swift: