I\'m trying to do something that I already know how to do - but it isn\'t working. Looking for ideas to fix this. I think it\'s something to do with the way Xcode 4.1 create
The root object of you .plist is a dict
, so you need to load it in memory as a NSDictionary
.
myDictionary = [[NSDictionary alloc] initWithContentsOfFile: myFile];
If you just want the plist loaded, you need to use property list serialization to first load the plist as NSData
[[NSData alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"File1"]]
then serialize it into a dict (or array, depending on what your root item is) using
NSDictionary *aDict = [NSPropertyListSerialization propertyListWithData: options: format: error:]
When you view the plist in Xcode, the top level element is the type to make aDict.
See here for more info: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/SerializePlist/SerializePlist.html
If you want the entire plist loaded as strings, you probably need to do something with an NSString method, something like [NSString stringFromData]
.