fix(iOS): file picker crash (#1567)

* fix(iOS): Consider UIImagePickerController or similar controllers that are no longer beingPresented when acquiring the TopViewController; this prevents the crash of throwing an alert on a ViewController which is no longer in the window hierarchy

* fix(iOS): correcting import to src from lib

* fix(iOS): reverting import modification

Co-authored-by: Thibault Malbranche <thibault.malbranche@epitech.eu>
This commit is contained in:
jxm2004
2020-08-13 09:36:45 +02:00
committed by GitHub
co-authored by Thibault Malbranche
parent 096002e12f
commit 05c1d8f264
+1 -1
View File
@@ -878,7 +878,7 @@ static NSDictionary* customCertificatesForHost;
*/
-(UIViewController *)topViewControllerWithRootViewController:(UIViewController *)viewController{
if (viewController==nil) return nil;
if (viewController.presentedViewController!=nil) {
if (viewController.presentedViewController!=nil && viewController.presentedViewController.isBeingPresented) {
return [self topViewControllerWithRootViewController:viewController.presentedViewController];
} else if ([viewController isKindOfClass:[UITabBarController class]]){
return [self topViewControllerWithRootViewController:[(UITabBarController *)viewController selectedViewController]];