iDevGames Forums
save data of the app, and not loose them if i update the app - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: save data of the app, and not loose them if i update the app (/thread-10365.html)



save data of the app, and not loose them if i update the app - sefiroths - Oct 16, 2012 07:19 AM

if i have a local data of an app, suppose a local highscore where i store all my score of the game.
if i release an update of the app, i loose all data.
i save data with this method:
Code:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filename = [documentsDirectory stringByAppendingPathComponent:@"defaultStage.dat"];
    
    char cstr[512]={0};
    [filename getCString:cstr maxLength:512 encoding:NSASCIIStringEncoding];
    
    defaultStage=1;
    FILE *pFile=fopen(cstr, "wb");
//and save with fprintf
there is a way that save the data "permanently" not to loose when i reinstall, or update the app?
thanks


RE: save data of the app, and not loose them if i update the app - OneSadCookie - Oct 16, 2012 11:30 AM

the documents directory shouldn't be being deleted on app update...


RE: save data of the app, and not loose them if i update the app - sefiroths - Oct 16, 2012 12:01 PM

thanks for response, i'll double check next time i'll update the app