Return to Snippet

Revision: 23580
at February 9, 2010 16:06 by espinallab


Updated Code
//What you want to do is write it into your sandbox Documents directory like so:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];


//or write it into your sandbox temporary (/tmp) directory like this

NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];


Reading it:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"patientList.plist"];

contentArray = [NSArray arrayWithContentsOfFile:path ];

Revision: 23579
at February 9, 2010 15:03 by espinallab


Initial Code
//What you want to do is write it into your sandbox Documents directory like so:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];


//or write it into your sandbox temporary (/tmp) directory like this

NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];

Initial URL
http://www.iphonedevsdk.com/forum/iphone-sdk-development/5823-save-plist-properity-list.html

Initial Description

                                

Initial Title
Save to .plist properity list

Initial Tags
list

Initial Language
Objective C