I have a problem with detecting retina displays on iOS devices. I'm using the following code which was recommended by various people:
BOOL isRetina()
{
UIScreen* s = [UIScreen mainScreen];
if ([s respondsToSelector:@selector(displayLinkWithTarget:selector:)] &&
[s respondsToSelector:@selector(scale)])
{
CGFloat scale = [s scale];
return scale == 2.0;
}
return NO;
}
The problem is that it compiles fine for deployment target iOS 4 and higher, but when I compile for iOS3.2 I get an "Incompatible types in initialization" error at the "scale = [s scale]" line because I'm trying to assign an id to a float. I couldn't find anything about that. Since everyone else seems to be using this approach I must be missing something really obvious here? Base SDK version is 4.3 with XCode 4 by the way.
Here are my BaseSDK/Deployment Target settings:
Update: I've solved it. Basically the problem was some XCode issue. To fix some other problem I had to uninstall and reinstall XCode. After that the behavior was gone.