Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
for apps that allow textual input (like word processors), where is that data saved on the iPhone? app-specific database? .plist file? are there any simple tutorials that i can use to calm my curiosity?

im not terribly new to development, but i know next to nothing about iPod dev.



*i know this is prob an elementary question, but i've never actually used an iPhone/iPod Touch before... so you can understand where my curiosity is coming from.
 

Farani

macrumors 6502
Oct 21, 2007
267
0
This is right out of an apple example program:

NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
self.pathToUserCopyOfDatabasePlist = [documentsDirectory stringByAppendingPathComponent:mad:"database.plist"];
if ([fileManager fileExistsAtPath:pathToUserCopyOfDatabasePlist] == NO) {
NSString *pathToDefaultPlist = [[NSBundle mainBundle] pathForResource:mad:"database" ofType:mad:"plist"];
if ([fileManager copyItemAtPath:pathToDefaultPlist toPath:pathToUserCopyOfDatabasePlist error:&error] == NO) {
NSAssert1(0, @"Failed to copy data with error message '%@'.", [error localizedDescription]);
}
}

It gets saved in the user's documents directory.
 

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
This is right out of an apple example program:



It gets saved in the user's documents directory.

ok... so it's saved as the app's .plist in the iPhone's documents directory? even if there are hundreds/thousands of user entered strings, they all just get saved to the app's .plist?
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
It's not automatic. It's up to your app to choose where it wants to save its data. Read the OS programming guide. You can save it in a file of whatever format you like. You can save it on a web server in China. It's up to you to decide.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.