What type of file do i use for NSMutableDictionary withcontentofURL?
I want to fill a NSMutableDictionary with content out of a URL File. What type file must it be and how must it be structured?
NSMutableDictionary *myMutableDictionary = [[NSMutable开发者_C百科Dictionary alloc]
initWithContentsOfURL:[NSURL URLWithString:@"http://example.com/list.txt"]];
It has to be in the XML property list format 1:
An URL that identifies a resource containing a string representation of a property list whose root object is a dictionary. The dictionary must contain only property list objects (instances of NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary).
See here for an overview of the property list types.
E.g. the following file:
<plist version="1.0">
<dict>
<key>A</key><string>something</string>
<key>B</key><integer>42</integer>
</dict>
</plist>
... becomes a dictionary containing:
{
A = something;
B = 42;
}
精彩评论