I have been trying to load different strings for a library by loading different bundles containing these strings.
I am using https://github.com/firebase/FirebaseUI-iOS but the solution to this problem might not be specific to Firebase, so please share any thoughts and ideas.
The FUIAuthPickerViewController class can be subclassed in order to differentiate it, but the "Sign in" labels on the buttons cannot change. The only solution would seem to use custom strings loaded from a different bundle as is described here: https://github.com/firebase/FirebaseUI-iOS/tree/master/FirebaseAuthUI#custom-strings
So, what I have done is create a FirebaseSignUp.bundle file with the following contents (using the same files and filenames as they are in the FirebaseUI pod):
en.lproj (folder within the bundle)
--FirebaseAuthUI.strings
--FirebaseFacebookAuthUI.strings
--FirebaseGoogleAuthUI.strings
--FirebaseTwitterAuthUI.strings
and in these files I have replaced the "Sign in" strings with "Sign up" ones.
So, when I want to show the "sign in" screen, then I use the following code:
FUIAuth *authUI = [FUIAuth defaultAuthUI];
authUI.delegate = self;
authUI.customStringsBundle = [NSBundle mainBundle];
and when I want to show the "sign up" screen, I do the following:
FUIAuth *authUI = [FUIAuth defaultAuthUI];
authUI.delegate = self;
NSString *signUpStringsFilePath = [[NSBundle mainBundle] pathForResource:@"FirebaseSignUp"
ofType:@"bundle"];
authUI.customStringsBundle = [NSBundle bundleWithPath:signUpStringsFilePath];
The problem is that when I do the above, only the "Sign up with email" label changes - so the label that is in the FirebaseAuthUI.strings. The other labels stay the same.
Switching between the two screens also works for that label consistently, so the issue is on managing to change the other strings. For some reason it fails to locate the strings in the bundle I created.
Any suggestions are welcome! Cheers!