PDA

View Full Version : Where to find a plist file in my app?




mikezang
Jul 29, 2010, 07:33 AM
I made app and use plist to save data, but I can"t find it. I defined it as below:

#define kFilename @"trade.plist"


and use it like this:

-(NSString *) dataFilePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:kFilename];
}
...
[array writeToFile:[self dataFilePath] atomically:YES];


But it is very strange because I couldn't find that plist file, even in ~home/Library/Application Support/iPhone Simulator/, where can I find it?



PhoneyDeveloper
Jul 29, 2010, 10:19 AM
If you mean find it in the Finder then why don't you log the path when you write the file?

mikezang
Jul 29, 2010, 08:46 PM
Thanks for your suggestion.

I got it, but the problem is that I just create that project, so that I thought that plist file should in the newest app folder, but I can't find, then I log path and I got it, it is not in the newest app folder, but in a older app folder!

I am not sure about this, why the newest project's app folder is not the newest?

PhoneyDeveloper
Jul 30, 2010, 10:19 AM
I've seen that too. I have no explanation. I see multiple app folders get created for one app. Sometimes one is used and sometimes another one is used. Kind of annoying when user data disappears. Having the folders open in the Finder may affect this.