I have a menu scene, help scene, settings scene and game scene. When i enter into game scene, it loads some data string from a .plist file into a NSMutableArray. I am doing this reading and loading procedure as follows-
+ (void) addObjectsToArray:(NSMutableArray*) mutableArray fromFile:(NSString*) filePath
{
NSString *bundle = [[NSBundle mainBundle] bundlePath];
NSString *path = [bundle stringByAppendingPathComponent:filePath];
[mutableArray addObjectsFromArray: [NSMutableArray arrayWithContentsOfFile:path]];
[bundle release];
}
I can get into the game scene and can back to menu scene from there. But when I try to get into the game scene forth time(menu scene to game then back to menu scene and go to game scene again and do), the app just crashes.
I have found the crash point(using NSLog)-
+ (void) addObjectsToArray:(NSMutableArray*) mutableArray fromFile:(NSString*) filePath
{
NSString *bundle = [[NSBundle mainBundle] bundlePath];
**NSLog(@"always reach here");**
NSString *path = [bundle stringByAppendingPathComponent:filePath];**// CRASH POINT**
**NSLog(@"Forth time, doesnt reach here");**
[mutableArray addObjectsFromArray: [NSMutableArray arrayWithContentsOfFile:path]];
[bundle release];
}
But why crashing i dont understand and found no solution yet.