views:

63

answers:

1

Hi, everyone. I'm new here. Now I'm having a problem for my app, a chinese-english dictionary. I'm now adding a wordbook for it, and try to save the contents of it to a plist every time users exit the app. But now I find that as my app updates, all these data will get lost because the path of the app is changed.

I'm now working for a company so the app will keep releasing new versions, and how can I save the data from version to version?

+2  A: 

all these data will get lost because the path of the app is changed.

That would indicate you're writing to your application's directory structure. Don't do that.

The iPhone has a documents directory.

Document Directory discussion

Wade Williams
well I'm just using the following code to get the path NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; with these code I can get the path in the NSString documentsDirectory like "var/moblie/Applications/***/Documents". But my problem is that every time when I reinstall the app(or install a new version), the "***" part will be changed to another randomized string. That's why I said the path of the app is changed. thx anyway.
WoodJohn
That may be true, but as it changes, the contents of the directory are copied along with it, so it should still be in that directory.
Ed Marty