Writing to a .plist file

Posted by sg on Stack Overflow See other posts from Stack Overflow or by sg
Published on 2010-04-08T15:41:08Z Indexed on 2010/04/08 15:43 UTC
Read the original article Hit count: 256

Filed under:
|
|
|

I have a .plist with 2 key values in it. It is of type Dictionary. I am trying to write value to one of the key values. What's wrong with the code below? I also tried using type "Array". That option also does not work. How can I get it to work using Dictionary & also Array? Anyone has working code example? Thanks. I would appreciate any help.

NSString *filePath = @"myprefs.plist";

NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath];

[plistDict setValue:@"[email protected]" forKey:@"Email"];

[plistDict writeToFile:filePath atomically: YES];

© Stack Overflow or respective owner

Related posts about array

Related posts about dictionary