Skip to content

Commit

Permalink
Merge pull request #786 from rojo69/master
Browse files Browse the repository at this point in the history
Authentication with e-mail link was not working in iOS13.
  • Loading branch information
morganchen12 authored Oct 4, 2019
2 parents e0a6e13 + 977cb1b commit f029d98
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Auth/FirebaseAuthUI/FUIAuthBaseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#import "FUIAuthStrings.h"
#import "FUIAuthUtils.h"
#import "FUIAuth_Internal.h"
#import "objc/runtime.h"

/** @var kActivityIndiactorPadding
@brief The padding between the activity indiactor and its overlay.
Expand Down Expand Up @@ -287,6 +288,15 @@ + (void)showAlertWithTitle:(nullable NSString *)title
window.windowLevel = UIWindowLevelAlert + 1;
[window makeKeyAndVisible];
[viewController presentViewController:alertController animated:YES completion:nil];

if (@available(iOS 13.0, *)) {
/*
Earlier iOS versions established a strong reference to the window when makeKeyAndVisible was called.
Now we add one from the alert controller, to prevent objects from getting garbage collected right away.
*/
static char key;
objc_setAssociatedObject(alertController, &key, window, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
}
}

Expand Down

0 comments on commit f029d98

Please sign in to comment.