Reading data from a plist file

Posted by K2Digital on Stack Overflow See other posts from Stack Overflow or by K2Digital
Published on 2009-07-01T03:38:35Z Indexed on 2010/03/17 18:51 UTC
Read the original article Hit count: 208

Filed under:
|

I'm trying to implement a Save State for my iPhone App.

I've got a plist file called SaveData.plist and I can read it in via the following

NSString *pListPath2 = [bundle pathForResource:@"SaveData" ofType:@"plist"];
NSDictionary *dictionary2 = [[NSDictionary alloc] initWithContentsOfFile:pListPath2];

self.SaveData = dictionary2;
[dictionary release];

The Plist file has members

SavedGame which is a Boolean to tell the app if there really is valid data here (if they did not exit the app in the middle of a game, I don't want their to be a Restore Point.

Score which is an NSNumber. Time which is an NSNumber

Playfield which is a 16 element array of NSNumbers

How do I access those elements inside of the NSDictionary?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c