title: Detecting iOS version and Testing
body: <p>I am facing a very strange problem while testing my application (built according to <code>iOS 7</code>) on <code>iOS 6</code>. </p>
  
  <p>I have an <code>iPhone 5</code> and an <code>iPhone 4S</code> device that run on <code>iOS 7</code>. So, in order to check my app on <code>iOS 6</code>, i have downloaded the simulator for <code>iOS 6.1</code>. Also, i have changed the "<code>project Deployment Target</code>" in <code>project Settings</code> and <code>Target Settings</code> to <code>iOS 6.1</code>.</p>
  
  <p>The strange thing is that while running the code below, everything goes expected as long as i am selecting:</p>
  
  <pre><code>1) iPhone retina 4-inch (iPhone 5) simulator in combination with iOS 7.0
  2) iPhone retina 3.5-inch (iPhone 4S) simulator in combination with iOS 7.0
  3) iPhone retina 3.5-inch (iPhone 4S) simulator in combination with iOS 6.1
  </code></pre>
  
  <p>However, as soon as i select</p>
  
  <p><code>iPhone retina 4-inch simulator(iPhone 5)</code> in combination with <code>iOS 6.1</code>,</p>
  
  <p>the console shows</p>
  
  <p><code>iOS 6</code>, <code>iPhone 4S</code> and the screen size is 480 </p>
  
  <p>Here's the code that i am using:</p>
  
  <pre><code>CGRect screenRect = [[UIScreen mainScreen] bounds];
  
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 7.0)
      {
          [prefs setObject:@"iOS7" forKey:@"iOSType"];
  
          if (screenRect.size.height == 568)
          {
              NSLog(@"iOS 7, iPhone 5");
  
              [prefs setObject:@"iPhone5" forKey:@"DeviceType"];
              [prefs synchronize];
  
              self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone"  bundle:nil];
  
              self.hpvc = [[HomePageViewController alloc] initWithNibName:@"HomePageViewController_iPhone" bundle:nil];
          }
  
          else
          {
              NSLog(@"iOS 7, iPhone 4S");
  
              [prefs setObject:@"iPhone4S" forKey:@"DeviceType"];
              [prefs synchronize];
  
              self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone4S"  bundle:nil];
  
              self.hpvc = [[HomePageViewController alloc] initWithNibName:@"HomePageViewController_iPhone4S" bundle:nil];
          }
      }
  
      else
      {
          [prefs setObject:@"iOS6" forKey:@"iOSType"];
  
          if (screenRect.size.height == 568)
          {
              NSLog(@"iOS 6, iPhone 5");
  
              [prefs setObject:@"iPhone5" forKey:@"DeviceType"];
              [prefs synchronize];
  
              self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone"  bundle:nil];
  
              self.hpvc = [[HomePageViewController alloc] initWithNibName:@"HomePageViewController_iPhone" bundle:nil];
          }
  
          else
          {
              NSLog(@"iOS 6, iPhone 4S and the screen size is %f", screenRect.size.height);
  
              [prefs setObject:@"iPhone4S" forKey:@"DeviceType"];
              [prefs synchronize];
  
              self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone4S"  bundle:nil];
  
              self.hpvc = [[HomePageViewController alloc] initWithNibName:@"HomePageViewController_iPhone4S" bundle:nil];
          }
      }
  </code></pre>
  
  <p>Why is this happening?? why am i not able to combine iPhone 5 and iOS 6 together???</p>