The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Crash in iPad with iOS 3.2 (contentScaleFactor unimplemtd)
josebagar


Joined: 10 Dec 2010
Posts: 87
Hi!

I just found that SDL is crashing in the iPad simulator for iOS 3.2 but not for iOS 4.2 or over when compiling with Xcode 4.0.2.
The Xcode debugger points to line 127 in video/uikit/SDL_uikitopenglview.m as the line that triggers the crash.
On those lines one can find:
Code:
        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;
I believe the problem to be that -contrarily to what Apple docs appear to state- the "scale" selector is supported in iOS 3.2 in the iPad, but contentScaleFactor is not.
I'm no expert in Objective-C, but I believe the following code to be more correct (it doesn't crash for me):
Code:
        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [self respondsToSelector:@selector(contentScaleFactor)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;
The same check is being performed in line 155 so I imagine it will crash there, too.

I've filed a bug with this same info in Bugzilla:
http://bugzilla.libsdl.org/show_bug.cgi?id=1239
Crash in iPad with iOS 3.2
Eric Wing
Guest

I'm speaking from memory at the moment, but I think you want to use contentScaleFactor exclusively; don't use scale.

Basically:

float my_scale_factor = 1.0;
if([your_ui_view respondsToSelector:@selector(contentScaleFactor)]
{
    my_scale_factor = [your_ui_view contentScaleFactor];

}

-Eric




On Thu, Jun 30, 2011 at 7:07 PM, josebagar wrote:
Quote:
Hi!

I just found that SDL is crashing in the iPad simulator for iOS 3.2 but not for iOS 4.2 or over when compiling with Xcode 4.0.2.
The Xcode debugger points to line 127 in video/uikit/SDL_uikitopenglview.m as the line that triggers the crash.
On those lines one can find:


Code:


        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;


I believe the problem to be that -contrarily to what Apple docs appear to state- the "scale" selector is supported in iOS 3.2 in the iPad, but contentScaleFactor is not.
I'm no expert in Objective-C, but I believe the following code to be more correct (it doesn't crash for me):


Code:


        /* Use the main screen scale (for retina display support) */
        if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [self respondsToSelector:@selector(contentScaleFactor)])
                self.contentScaleFactor = [UIScreen mainScreen].scale;


The same check is being performed in line 155 so I imagine it will crash there, too.

I've filed a bug with this same info in Bugzilla:
http://bugzilla.libsdl.org/show_bug.cgi?id=1239


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
josebagar


Joined: 10 Dec 2010
Posts: 87
Sorry, I didn't explain myself correctly.
The crash occurs in SDL code (here). I'm working with an interpreted game engine built on top of SDL and the crash occurs when setting the video mode, I'm not writing any Objective-C code myself.

Joseba
josebagar


Joined: 10 Dec 2010
Posts: 87
To say it in other words: just downloading the SDL source code from HG and compiling and running the fireworks demo in the ipad 3.2 simulator crashes.