diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m index af4944d4d..1a8d63841 100644 --- a/CordovaLib/Classes/Public/CDVViewController.m +++ b/CordovaLib/Classes/Public/CDVViewController.m @@ -295,6 +295,17 @@ - (void)viewDidLoad { [super viewDidLoad]; + // TODO: Remove in Cordova iOS 9 + if ([UIApplication.sharedApplication.delegate isKindOfClass:[CDVAppDelegate class]]) { + CDVAppDelegate *appDelegate = (CDVAppDelegate *)UIApplication.sharedApplication.delegate; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + if (appDelegate.viewController == nil) { + appDelegate.viewController = self; + } +#pragma clang diagnostic pop + } + // Load settings [self loadSettings]; diff --git a/CordovaLib/include/Cordova/CDVAppDelegate.h b/CordovaLib/include/Cordova/CDVAppDelegate.h index 6b2670435..162b93791 100644 --- a/CordovaLib/include/Cordova/CDVAppDelegate.h +++ b/CordovaLib/include/Cordova/CDVAppDelegate.h @@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nullable, nonatomic, strong) IBOutlet UIWindow *window API_DEPRECATED_WITH_REPLACEMENT("SceneDelegate:window", ios(2.0, 13.0)); // TODO: Remove in Cordova iOS 9 -@property (nullable, nonatomic, strong) IBOutlet CDVViewController *viewController CDV_DEPRECATED(8, "This will always be nil."); +@property (nullable, nonatomic, strong) IBOutlet CDVViewController *viewController CDV_DEPRECATED(8, ""); @end