NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"HighScore.plist"];
NSMutableArray* plistDict = [[NSMutableArray alloc]
initWithContentsOfFile:finalPath];
[plistDict addObject:[highScoreLabel text]];
NSArray *regArray = [NSMutableArray arrayWithArray:plistDict];
[regArray writeToFile:@"HighScore.plist" atomically: YES];
NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@HighScore.plist]; NSMutableArray* plistDict =
Share
Does the file exist and contains valid data?
See Apple’s documentation about
NSMutableArray initWithContentsOfFile::If
initWithContentsOfFile:returnsnil, it’s clear that the rest of the code won’t work either.