ZIKRouter
ZIKRouter copied to clipboard
iOS 13 获取window方案调整了希望可以修复一下
iOS 13 获取window方案调整了希望可以修复一下zix_isAppRootViewController
- (BOOL)zix_isAppRootViewController { Class XXApplication = NSClassFromString(@"UIApplication"); id sharedApplication = [XXApplication performSelector:@selector(sharedApplication)]; id appDelegate = [sharedApplication performSelector:@selector(delegate)]; XXWindow *window = nil; if ([appDelegate respondsToSelector:@selector(window)]) { window = [appDelegate performSelector:@selector(window)]; } else if ([sharedApplication respondsToSelector:@selector(keyWindow)]) { window = [sharedApplication performSelector:@selector(keyWindow)]; } else { window = [UIApplication sharedApplication].windows.firstObject; } XXViewController *rootViewController = window.rootViewController; if (rootViewController) { return rootViewController == self; } //Maybe in app extension id nextResponder = [self nextResponder]; if ([nextResponder isKindOfClass:[XXWindow class]]) { if ([[nextResponder nextResponder] isKindOfClass:XXApplication]) { return YES; } } return NO; }