Save to .plist properity list


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //What you want to do is write it into your sandbox Documents directory like so:
  2.  
  3. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  4. NSString *documentsDirectory = [paths objectAtIndex:0];
  5. NSString *path = [documentsDirectory stringByAppendingPathComponent:@"patientList.plist"];
  6. [myPatients writeToFile:path atomically:YES];
  7.  
  8.  
  9. //or write it into your sandbox temporary (/tmp) directory like this
  10.  
  11. NSString *path = [NSTemporaryDirectory() stringByAppendingPathComponent:@"patientList.plist"];
  12. [myPatients writeToFile:path atomically:YES];
  13.  
  14.  
  15. Reading it:
  16.  
  17. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  18. NSString *documentsDirectory = [paths objectAtIndex:0];
  19. NSString *path = [documentsDirectory stringByAppendingPathComponent:@"patientList.plist"];
  20.  
  21. contentArray = [NSArray arrayWithContentsOfFile:path ];

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.