|
|
@@ -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
|