<dict>
<key>Name</key>
<string>Ramesh</string>
<key>Address</key>
<string>Delhi</string>
</dict>
如何在plist文件中以及在任何特定父标记内的运行时写入此内容。
答案 0 :(得分:0)
只需设置此词典,就可以将plist写入apps目录。
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"Name", @"Ramesh", @"Address", @"Delhi", nil];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"dictionary.plist"];
[dictionary writeToFile:path atomically:YES];