0

in AppDelegate.h file, I add

#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

and in AppDelegate.m file, I add

if (iPhone5) {
    NSLog(@"iPhone5/5s")
}
else {
    NSLog(@"not iPhone5/5s");
}

but it shows log not iPhone5/5s when I run this project in iPhone 5 or 5s, in my project, I just add cocoapods, and open this project file that cocoapods created(projectname.xcworkspace). BTW, it runs right if i create a new project without using cocoapods, so how can i fix it?

bobnoble
  • 5,794
  • 3
  • 25
  • 32
Bin
  • 484
  • 1
  • 6
  • 18
  • Have you use iPhone5 variable name anywhere else? Please check – Karan Dua Jun 22 '14 at 13:53
  • #define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) try this one – Karan Dua Jun 22 '14 at 13:55
  • @KaranDua i think, the question isn't on `#define iPhone5..` here, i can use this code in other project, it runs well, but only this project that i use cocoapods can't runs right. your code is also doesn't work. thanks – Bin Jun 22 '14 at 13:58
  • @KaranDua i try to get height by using `[[UIScreen mainScreen ] bounds ].size.height`, and always get 480, not 568, both in real device(iPhone 5) and in simulator(4-inch). – Bin Jun 22 '14 at 14:05
  • Your app is not iPhone 5 compatible. – Karan Dua Jun 22 '14 at 14:10
  • @KaranDua i don't think so, i create this project by using xcode 5.1.1 (the latest version) on osx 10.9.3, and i can run it well before until i add cocoapods to this project. – Bin Jun 22 '14 at 14:15
  • Have You added the Default-568h@2x.png to your project? – Karan Dua Jun 22 '14 at 14:18
  • @KaranDua thanks, i am really forgetting this. so shy. – Bin Jun 22 '14 at 14:21

0 Answers0