aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Auth/Source/FIRAuth.m
diff options
context:
space:
mode:
authorGravatar Rich Gowman <rgowman@google.com>2018-06-12 10:27:17 -0400
committerGravatar Rich Gowman <rgowman@google.com>2018-06-12 10:27:17 -0400
commitcf2899a085f7ceca3fad2d1fb5336be25cecd7ff (patch)
tree38c835a29fcda279c8dd220781d2b5c726da307f /Firebase/Auth/Source/FIRAuth.m
parent1597765af8c897ab73d21d6d404f8eeede7890b1 (diff)
parent9307f4893008f7d6cf9473e906d4c896546c5c8c (diff)
Merge remote-tracking branch 'origin/master' into rsgowman/protobuf_cpp
Also "fixed" BadFieldValueTagWithOtherValidTagsPresent test by changing 'false' to 'true'. Details: Depending on the version of nanopb, nanopb would explicitly encode 'false', which shouldn't be done in proto3. When it's explicitly encoded, the test worked properly. But when it was (properly) dropped, the invalid tag is the only field that's actually encoded, thus violating the assumptions of the test, leading to a test failure. s/false/true fixes it, as now the boolean_value field is (properly) encoded regardless of version.
Diffstat (limited to 'Firebase/Auth/Source/FIRAuth.m')
-rw-r--r--Firebase/Auth/Source/FIRAuth.m14
1 files changed, 13 insertions, 1 deletions
diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m
index c83a19a..81008ca 100644
--- a/Firebase/Auth/Source/FIRAuth.m
+++ b/Firebase/Auth/Source/FIRAuth.m
@@ -19,6 +19,7 @@
#import "FIRAuth_Internal.h"
#import <FirebaseCore/FIRAppAssociationRegistration.h>
+#import <FirebaseCore/FIRAppEnvironmentUtil.h>
#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseCore/FIRLogger.h>
#import <FirebaseCore/FIROptions.h>
@@ -438,7 +439,18 @@ static NSMutableDictionary *gKeychainServiceNameForAppName;
_settings = [[FIRAuthSettings alloc] init];
_firebaseAppName = [appName copy];
#if TARGET_OS_IOS
- UIApplication *application = [UIApplication sharedApplication];
+
+ static Class applicationClass = nil;
+ // iOS App extensions should not call [UIApplication sharedApplication], even if UIApplication
+ // responds to it.
+ if (![FIRAppEnvironmentUtil isAppExtension]) {
+ Class cls = NSClassFromString(@"UIApplication");
+ if (cls && [cls respondsToSelector:NSSelectorFromString(@"sharedApplication")]) {
+ applicationClass = cls;
+ }
+ }
+ UIApplication *application = [applicationClass sharedApplication];
+
// Initialize the shared FIRAuthAppDelegateProxy instance in the main thread if not already.
[FIRAuthAppDelegateProxy sharedInstance];
#endif