Cocos2d: .plist file giving me a SIGABRT error

138 views Asked by At

Hello I am making a side scrolling cocos2d app. I am using a .plist file for most of the data in my game. When I run the code it immediately gives me a SIGABRT error. I am new to objective c and cocos2d and I am not experienced with .plist files. This is the .plist file. enter image description here

This is the code that I am pretty sure is causing the problem.

NSString *path = [[NSBundle mainBundle] bundlePath];
    NSString *finalPath = [path stringByAppendingPathComponent:@"GameData.plist"];
    NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:finalPath];

    NSMutableArray* characterArray = [NSMutableArray arrayWithArray:[plistData objectForKey:@"Characters"]];
    NSDictionary *theCharacterDict = [NSDictionary dictionaryWithDictionary:    [characterArray objectAtIndex:0]];


NSDictionary* characterDict = [NSDictionary dictionaryWithDictionary:[theCharacterDict   objectForKey:@"PlayerProperties"]];
    character = [Character createWithDictionary:characterDict];
    [self addChild:character z:kCharacterLevel];

I do not know if this is the code that is causing the problem. I will post more code if needed.

1

There are 1 answers

0
jake1k On

Okay I don't know if this is what is causing the error, but I immediately spotted an error in your code. NSMutableArray* characterArray The asterisk should be immediately before characterArray.

As I read further, there are several minor errors in the code you posted. Asterisks are in the wrong places are there are too many spaces in certain areas. My suggestion is to read through your code line by line to help catch such errors.