I have this iPhone or iPhone 5 conditional statement in a locationUpdate: method.
This code works:
- (void)locationUpdate:(CLLocation *)location {
//locLabel.text = [location description];
#ifdef DEBUG
NSLog(@"auth status is %u", [CLLocationManager authorizationStatus]);
#endif
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
OffersViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"OffersViewController"];
[self.navigationController pushViewController:lvc animated:NO];
}
but when the iphone5 conditional code. It fails. The app doesn't crash but just remains on the view controller (RootViewController) and doesn't push to either the OffersViewController or the OffersViewControlleriPhone.
- (void)locationUpdate:(CLLocation *)location {
//locLabel.text = [location description];
#ifdef DEBUG
NSLog(@"auth status is %u", [CLLocationManager authorizationStatus]);
#endif
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
if ([[UIScreen mainScreen] respondsToSelector: @selector(scale)]) {
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width * scale, result.height * scale);
if(result.height == 960) {
NSLog(@"iPhone 4 Resolution");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
OffersViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"OffersViewController"];
[self.navigationController pushViewController:lvc animated:NO];
}
**else if(result.height == 1136) {
NSLog(@"iPhone 5 Resolution");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
OffersViewControlleriPhone5 *lvc = [storyboard instantiateViewControllerWithIdentifier:@"OffersViewControlleriPhone5"];
[self.navigationController pushViewController:lvc animated:NO];
}**
}
else {
NSLog(@"Standard Resolution");
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle: nil];
OffersViewController *lvc = [storyboard instantiateViewControllerWithIdentifier:@"OffersViewController"];
[self.navigationController pushViewController:lvc animated:NO];
}
}
}
it seems to be the else if statement for the iPhone5 that's the problem. It doesn't work even if I change the OffersViewControlleriPhone5 to OffersViewController.
thanks for any help