BEST WAY TO SAVE DATA ON THE IPHONE

Jayne Spooner

Total Post:21

Points:147
Posted by  Jayne Spooner
 850  View(s)
Ratings:
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. Tarun Kumar

    Post:214

    Points:1642
    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!