From 6ae87c9dc05e5feb6650f17b321fd9807841fc0d Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 13 Mar 2015 11:03:29 -0400 Subject: [PATCH] CB-8659: ios: 4.0.x Compatibility: Remove use of initWebView method --- src/ios/CDVConnection.m | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m index cbf4d69..3749767 100644 --- a/src/ios/CDVConnection.m +++ b/src/ios/CDVConnection.m @@ -110,22 +110,18 @@ [self updateReachability:self.internetReach]; } -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView +- (void)pluginInitialize { - self = [super initWithWebView:theWebView]; - if (self) { - self.connectionType = @"none"; - self.internetReach = [CDVReachability reachabilityForInternetConnection]; - self.connectionType = [self w3cConnectionTypeFor:self.internetReach]; - [self.internetReach startNotifier]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) - name:kReachabilityChangedNotification object:nil]; - if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil]; - } + self.connectionType = @"none"; + self.internetReach = [CDVReachability reachabilityForInternetConnection]; + self.connectionType = [self w3cConnectionTypeFor:self.internetReach]; + [self.internetReach startNotifier]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) + name:kReachabilityChangedNotification object:nil]; + if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil]; } - return self; } @end