title: is device iPhone or iPad programmatically
body: <p>I am developing global application (iPhone and iPad). I am doing different process for iPhone or iPad. But I saw crash like below screen shot. This crash device is iPhone but have run the code I wrote for iPad. How could this be. I wrote code that distinguishes the iPhone and iPad is faulty? thanx </p>
  
  <p><img src="https://i.stack.imgur.com/EiS6W.png" alt="enter image description here"></p>
  
  <pre><code>   -(IBAction)showSearchAirports:(id)sender{
  
          UIButton *tempButton=(UIButton*)sender;
  
          AirportSearch2 *airportsSearch=[[AirportSearch2 alloc] initWithNibName:@"AirportSearch" bundle:nil];
  
          if ([self isDeviceiPhone]) {
              [self presentViewController:airportsSearch animated:YES completion:NULL];
          }else{
  
  
                  if (self.popOver) {
                      [self.popOver dismissPopoverAnimated:YES];
                      self.popOver = nil;
  
                  }
  
                  UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:airportsSearch] autorelease];
  
  
                  self.popOver=[[[UIPopoverController alloc] initWithContentViewController:navigationController] autorelease];
  
                  self.popOver.delegate                    = self;
                  [self.popOver setPopoverContentSize:CGSizeMake(285, 370)];
  
                  //This line 481
                  [self.popOver presentPopoverFromRect:tempButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
  
  
          }
  
  }
  
  
  
  -(BOOL)isDeviceiPhone{
      if([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
          return  TRUE;
      else
          return FALSE;
  }
  </code></pre>