iMiniB3D will not run on IOS 5.0 Simulator

BlitzMax Forums/MiniB3D Module/iMiniB3D will not run on IOS 5.0 Simulator

Rob Pearmain(Posted 2011) [#1]
When I try to run a demo, (iMiniB3D 0.4), Xcode stops on:

nt retVal = UIApplicationMain(argc, argv, nil, nil);


In Main:

int main(int argc, char *argv[]) {
	
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	int retVal = UIApplicationMain(argc, argv, nil, nil);
	[pool release];
	return retVal;
	
}


The error I get is:

Thread 1: Program received signal "SIGABRT"


Any help would be much appreciated

Last edited 2011


Rob Pearmain(Posted 2011) [#2]
When I try to run a demo, (iMiniB3D 0.4), Xcode stops on:

int retVal = UIApplicationMain(argc, argv, nil, nil);


In Main:

int main(int argc, char *argv[]) {
	
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	int retVal = UIApplicationMain(argc, argv, nil, nil);
	[pool release];
	return retVal;
	
}


The error I get is:

Thread 1: Program received signal "SIGABRT"


Any help would be much appreciated

Last edited 2011


Rob Pearmain(Posted 2012) [#3]
It is when I try to loadanimmesh, I think related to:

http://www.blitzbasic.com/Community/posts.php?topic=96640

It is on the line

// Zombie model by Psionic
zombie=Mesh::LoadAnimMesh("zombie.b3d");

Last edited 2012


simonh(Posted 2012) [#4]
Yes, it's related to that topic. Follow the advice in there and it should fix it.


Rob Pearmain(Posted 2012) [#5]
I followed the instructions, but no change

Stepping through the code, it fails on the return of this function
On return filename2...
string File::ResourceFilePath(string filename){




	if(filename==""){
		return "";
	}	

	if(filename==""){
		return "";
	}
	
	const char* c_filename=filename.c_str();

	NSString* ns_string = [NSString stringWithUTF8String: c_filename];

	NSArray* ns_string_parts = [ns_string componentsSeparatedByString:@"."];

	if([ns_string_parts count]!=2) return "";

	NSString* ns_string_part1=[ns_string_parts objectAtIndex: 0];
	NSString* ns_string_part2=[ns_string_parts objectAtIndex: 1];

	if([ns_string_part1 length]==0 || [ns_string_part2 length]==0){
		return "";
	}

	CFStringRef fileString;
	fileString = (CFStringRef)[[NSBundle mainBundle] pathForResource:ns_string_part1 ofType:ns_string_part2];

	if(fileString==0) return "";

	//cout << "fileString: " << fileString << endl;

	const char* filename2=CFStringGetCStringPtr(fileString,CFStringGetSystemEncoding());
	
	return filename2;
BANG!
}


Last edited 2012

Last edited 2012


Rob Pearmain(Posted 2012) [#6]
Ok, more testing and there are actually 2 issues, I have found this:

1. It does not run in the IOS 5 Simulator, but does run on an IOS 5 Device.

This was the PeekFloat issue (In the other thread), so this is currently in hand

2. In the OS 5 Simulator it fails on ResourceFilePath

I think this is a separate / environmental issue

On 4.3 Emulation, the following returns a valid String. On 5 it returns NIL:

const char* filename2=CFStringGetCStringPtr(fileString,CFStringGetSystemEncoding());

On 4.3 fileString=/Users/rob/Library/Application Support/iPhone Simulator/4.3.2/Applications/082EADAE-964C-4EAF-94E3-0BB7F944FE2F/bird.app/Cam.bbm

filename2 = the full path

fileString: 0x4c54ce0
filename2: /Users/rob/Library/Application Support/iPhone Simulator/4.3.2/Applications/082EADAE-964C-4EAF-94E3-0BB7F944FE2F/bird.app/Cam.bbm

This works

On 5.0 fileString= /Users/rob/Library/Application Support/iPhone Simulator/5.0/Applications/AA9F5493-6165-4F23-AD45-1539DB21347B/bird.app/Cam.bbm

filename2 = NIL

fileString: 0x6e26ac0
filename2: terminate called throwing an exception

Current language: auto; currently objective-c

This fails


So

1. It compiles and runs ok in 4.3 Simulator and on 5.0 Device (With PeekFloat change)
2. It compiles and bombs out in the ResourceFilePath function on the 5.0 Simulator

Thanks

Rob

Last edited 2012

Last edited 2012

Last edited 2012

Last edited 2012


Rob Pearmain(Posted 2012) [#7]
FIXED (Workaround)

Changed:

const char* filename2=CFStringGetCStringPtr(fileString, CFStringGetSystemEncoding());


to

    NSString *nsString = (NSString *) fileString; // toll free bridge
    
    const char *filename2 = [nsString UTF8String];


And it worked!

Not sure why this works in 4.3 and 5.0 whereas the original worked in 4.3 only :-(

Last edited 2012

Last edited 2012


Yasha(Posted 2012) [#8]
Hang on... I did have this problem too! I just totally forgot about it until you got to more or less the same fix as I did.

Really sorry about that. I could have saved you a couple of days of bother if I'd been paying more attention.


Rob Pearmain(Posted 2012) [#9]
Lol, i have learned so much about debugging in xcode, time well spent ;-)