RSS

How to Read/Write from pList file

17 Apr

1 ) How to write to plist file ?
Ans : first you have to add plist file to your project.
and then code accordingly where you want to write into this file…
Code To Write File :

NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@”Hello.plist”];
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:path];

[plistDict setValue:@”10″ forKey:@”score”];
[plistDict writeToFile:path atomically: YES];

2 ) How to read From plist File ?

Ans :

Code :

NSDictionary *dic = [NSDictionary dictionaryWithContentsOfFile:path];
NSLog(@”Diction read : %@”,dic);

Advertisements
 
Leave a comment

Posted by on April 17, 2012 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: