You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Perry Stoll (JIRA)" <ji...@apache.org> on 2015/09/24 22:13:04 UTC

[jira] [Updated] (CB-9702) Fix plugin initialization based on XCode 7.0 compiler warnings

     [ https://issues.apache.org/jira/browse/CB-9702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Perry Stoll updated CB-9702:
----------------------------
    Description: 
xcode complains "These will always evaluate to true", which, looking at these lines, makes sense. These things are objects, taking their address will always yield a non-null value. 

{code}
cordova-plugin-network-information pstoll$ git diff
diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m
index 3749767..223dd7c 100644
--- a/src/ios/CDVConnection.m
+++ b/src/ios/CDVConnection.m
@@ -118,7 +118,7 @@
     [self.internetReach startNotifier];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
                                                  name:kReachabilityChangedNotification object:nil];
-    if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
+    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];
     }
{code}


  was:
xcode complains "These will always evaluate to true", which, looking at these lines, makes sense. These things are objects, taking their address will always yield a non-null value. 

cordova-plugin-network-information pstoll$ git diff
diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m
index 3749767..223dd7c 100644
--- a/src/ios/CDVConnection.m
+++ b/src/ios/CDVConnection.m
@@ -118,7 +118,7 @@
     [self.internetReach startNotifier];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
                                                  name:kReachabilityChangedNotification object:nil];
-    if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
+    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];
     }



> Fix plugin initialization based on XCode 7.0 compiler warnings
> --------------------------------------------------------------
>
>                 Key: CB-9702
>                 URL: https://issues.apache.org/jira/browse/CB-9702
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Network Information
>    Affects Versions: Master
>         Environment: XCode Version 7.0 (7A220)
>            Reporter: Perry Stoll
>
> xcode complains "These will always evaluate to true", which, looking at these lines, makes sense. These things are objects, taking their address will always yield a non-null value. 
> {code}
> cordova-plugin-network-information pstoll$ git diff
> diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m
> index 3749767..223dd7c 100644
> --- a/src/ios/CDVConnection.m
> +++ b/src/ios/CDVConnection.m
> @@ -118,7 +118,7 @@
>      [self.internetReach startNotifier];
>      [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
>                                                   name:kReachabilityChangedNotification object:nil];
> -    if (&UIApplicationDidEnterBackgroundNotification && &UIApplicationWillEnterForegroundNotification) {
> +    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];
>      }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org