1

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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
WoodJohn
  • 11
  • 1
  • Depending on the size and complexity of the wordbook, it might be better to let Core Data manage your data: http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html. – Steve Harrison Jan 09 '10 at 08:41

1 Answers1

2

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

Community
  • 1
  • 1
wadesworld
  • 13,535
  • 14
  • 60
  • 93
  • 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 Jan 09 '10 at 10:00
  • 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 Jan 09 '10 at 15:49