title: #ifdef __IPHONE_8_0 code runs also on iOS 7
body: <p>I've got the following code in my app - and I see some crashes on iOS 7 in the line with the comment.</p>
  
  <pre><code>+ (void)registerDeviceForRemoteNotifications {
  #if !TARGET_IPHONE_SIMULATOR
      if ([[KOAAuthenticator sharedAuthenticator] currentUser] != nil) {
          UIApplication *sharedApplication = [UIApplication sharedApplication];
  #ifdef __IPHONE_8_0
          [sharedApplication registerForRemoteNotifications]; // &lt;--- CRASH HERE
  #else
          [sharedApplication registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
  #endif
      }
  #endif
  }
  </code></pre>
  
  <p>Crashlytics says: <code>-[UIApplication registerForRemoteNotifications]: unrecognized selector sent to instance 0x157d04290</code></p>
  
  <p>how's that even possible? This code shouldn't be called on iOS 7, right?</p>
  
  <p>EDIT: solution</p>
  
  <pre><code>+ (void)registerDeviceForRemoteNotifications {
  #if !TARGET_IPHONE_SIMULATOR
      if ([[KOAAuthenticator sharedAuthenticator] currentUser] != nil) {
  
          UIApplication *sharedApplication = [UIApplication sharedApplication];
  
  #ifdef __IPHONE_8_0
          if ([sharedApplication respondsToSelector:@selector(registerForRemoteNotifications)]) {
              [sharedApplication registerForRemoteNotifications];
          } else {
              [sharedApplication registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
          }
  #else
          [sharedApplication registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert];
  #endif
  
      }
  #endif
  }
  </code></pre>