Best way to save data on the iPhone

Total Post:21

 1119  View(s)
Rate this:

I was creating an iPhone application at the time of coding i need to save the state of my application.

My problem is that the data persisting across upgrades. Some applications that I was used clearly got this wrong, and so I would not prefer them, so please give me suggestion.

  1. Post:214

    Re: Best way to save data on the iPhone

    The simple way to do exactly this to save:

    NSMyUser *obj = [NSMyUser myUser];
    [obj setObject:@"TextToSave" forKey:@"keyToFindText"];

    To load:

    NSMyUser *obj = [NSMyUser myUser];
    NSString *textToLoad = [obj stringForKey:@"keyToFindText"];

    The important thing is that you do not store very large values in NSMyUser. There's a chance of getting in trouble with apple review if you do.
    Generally, user defaults is used for storing short keys and preferences such as the users volume level, wether they want to use game center, or send crash logs.

      Modified On Sep-21-2015 01:29:51 AM