Skip to content

Commit f029d98

Browse files
authored
Merge pull request #786 from rojo69/master
Authentication with e-mail link was not working in iOS13.
2 parents e0a6e13 + 977cb1b commit f029d98

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Auth/FirebaseAuthUI/FUIAuthBaseViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#import "FUIAuthStrings.h"
2222
#import "FUIAuthUtils.h"
2323
#import "FUIAuth_Internal.h"
24+
#import "objc/runtime.h"
2425

2526
/** @var kActivityIndiactorPadding
2627
@brief The padding between the activity indiactor and its overlay.
@@ -287,6 +288,15 @@ + (void)showAlertWithTitle:(nullable NSString *)title
287288
window.windowLevel = UIWindowLevelAlert + 1;
288289
[window makeKeyAndVisible];
289290
[viewController presentViewController:alertController animated:YES completion:nil];
291+
292+
if (@available(iOS 13.0, *)) {
293+
/*
294+
Earlier iOS versions established a strong reference to the window when makeKeyAndVisible was called.
295+
Now we add one from the alert controller, to prevent objects from getting garbage collected right away.
296+
*/
297+
static char key;
298+
objc_setAssociatedObject(alertController, &key, window, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
299+
}
290300
}
291301
}
292302

0 commit comments

Comments
 (0)