Search code examples
iosobjective-ciphonesaveplist

is saving in plist is really secure?


I am developping an ios game and i would like to know if the the saves in plist are secured ? I have some questions that i don't really know the answers for exemple if the user exit the apps during the time a save occurs what happend ?

I find plist very useful and easy to use i store for example a lot of coordinates and informations about the user interface but on these files i only read informations. And in other plist i store some datas likes high scores, statics, points that are needed to be refresh and saved with new values every time after a game over or when user buy new store accessories.

How to handle for example a corrupt file because of a bad saving. I can make a copy every on the new plist every odd game played and have a files that can be reload and not losed but it seems to be a bad solution and stupid but i don't want to create an app where users can lost all the data because of a saved failure and start the game from the begining.

I read some links like this one(Saving game score locally on iOS device...is security needed?) but i prefer to keep plist files than using NSUserDefaults because i have a lot of datas to save.

I think about a solution where the user can store a copy on the cloud of the plist like that he delete the app it can have access to his preferences or if a failure saved to retrieve automatically a valid file but it seems weird and i never work on that kind of stuff.

I read more posts and i really need advices here and hope i don't duplicate a question.


Solution

  • A quick, easy and reliable solution would be to use the PARSE library. I would use the Parse Core framework. It would save you a lot of headaches. https://parse.com/products/core#howitworks

    Code Example:

    // Create a new Parse object
    PFObject *post = [PFObject objectWithClassName:@"Post"];
    [post setObject:@"Hello World" forKey:@"title"];
    
    // Save it to Parse
    [post saveInBackground];
    

    They even have an option to SAVE EVENTUALLY for cases where you are not sure of Wifi/3g connectivity

    // Create the object.
    PFObject *gameScore = [PFObject objectWithClassName:@"GameScore"];
    gameScore[@"score"] = @1337;
    gameScore[@"playerName"] = @"Sean Plott";
    gameScore[@"cheatMode"] = @NO;
    [gameScore saveEventually];