I've upgraded xcode and ios sdk to the latest version (xcode 4.0 / ios sdk 4.3) and now I'm getting compiler errors on a project that was building before.
This is the code:
- (void)layoutSubviews
{
int w = 320;
int h = 480;
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
// You can't detect screen resolutions in pre 3.2 devices, but they are all 320x480
if (ver >= 3.2f){
UIScreen* mainscr = [UIScreen mainScreen];
w = mainscr.currentMode.size.width;
h = mainscr.currentMode.size.height;
if( ver >= 4.0f ) {
float scaleFactor = mainscr.scale;
// this will scale the OpenGLView for retina screens
self.contentScaleFactor = scaleFactor;
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.contentsScale=scaleFactor; //new line
}
}
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer *)self.layer];
setOpenGLSize(w,h);
[self drawView:nil];
}
And these are the errors:
error: property 'scale' not found on object of type 'UIScreen *' [2]
error: property 'contentScaleFactor' not found on object of type 'EAGLView *' [2]
error: property 'contentsScale' not found on object of type 'CAEAGLLayer *' [2]
I have Base SDK setted to iOS 4.3 and deployment target to iOS 3.0 If i set deplyment target to 4.3, the error dissapear, but I want the app to run on 3.0 and above.
What's wrong with the code or the project?