"SIGABRT" when starting SDL demo on iPhone?

I’ve successfully run my game and the demos that come with SDL 1.3 under XCode 3.2.5 for iPhone under the simulator. However, I need to test on an actual device, and since my iPod touch has OS 5.0.1 on it, I need to use XCode 4 with the iOS 5 SDK. I’m having some trouble though getting things running on XCode 4.2.

Here’s the weird thing. I can the demos at:

SDL/XCode-iOS/Demos/Demos.xcodeproj

just fine, but if I copy this project to my own project’s directory (along with source code and resource files), removing and re-adding anything as necessary so the project knows where to find the files again, then it compiles and runs, but crashes here in SDL_uikitappdelegate.m:

Code:

int main(int argc, char **argv)
{
int i;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

/* store arguments */
forward_argc = argc;
forward_argv = (char **)malloc((argc+1) * sizeof(char *));
for (i = 0; i < argc; i++) {
    forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
    strcpy(forward_argv[i], argv[i]);
}
forward_argv[i] = NULL;

/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
UIApplicationMain(argc, argv, NULL, [SDLUIKitDelegate getAppDelegateClassName]);   // CRASH: Thread 1: Program received signal: "SIGABRT"

/* free the memory we used to hold copies of argc and argv */
for (i = 0; i < forward_argc; i++) {
    free(forward_argv[i]);
}
free(forward_argv);

[pool release];
return exit_status;

}

See line above with the comment CRASH: Thread 1: Program received signal: “SIGABRT”

Why would simply moving the project cause this to crash? I am guessing something, maybe the info.plist, is not being set up correctly for the new project, but what?

I’m sorry - i don’t have a direct answer for your question - just
another question. How did you manage to do this? The readme is not
up-to-date, and i had no luck to compile my game for ios yet. Did you
use some other manual that is more recent? If yes, could you point me to
it please?

I will use xcode 4.2, too. so i would be interested in a solution, too -
but knowing how to get started would be even nicer :wink:

greetings
martinAm 26.01.2012 00:51, schrieb VernJensen:

I’ve successfully run my game and the demos that come with SDL 1.3
under XCode 3.2.5 for iPhone under the simulator. However, I need to
test on an actual device, and since my iPod touch has OS 5.0.1 on it,
I need to use XCode 4 with the iOS 5 SDK. I’m having some trouble
though getting things running on XCode 4.2.

My game uses OpenGL ES, so I had to update portions of the OpenGL calls to be compatible with that:

Secondly this blog answered some questions:

http://immersedcode.org/2011/4/27/sdl-ios-behavior/

The rest you can learn by running the demos included with SDL at:

SDL/XCode-iOS/Demos/

Update: the SIGABRT issue described above still happens even in XCode 3.2.5, simply due to copying the “DemosiPhoneOS.xcode” project from the SDL Demos directory to my own project’s directory (and replacing the files that can’t be found by XCode.)

Any ideas?

Okay, I figured out the problem! I had:

“Principal Class: NSApplication” in my info.plist file, that was being used on the Mac version of my game, and when I moved the SDL Demo over to the same folder, it happened to use my game’s info.plist since the filenames were the same.

Deleting this field from the info.plist allows the app to load properly!