ios - How would I be able to save an integer when an app is terminated and then load it again once the app is reopened? -


I'm working on an app where I need to save an int until the player decides to play the game again does not. It would be greatly appreciated if any person has guided me to save this integer using NISUER defaults, whenever the app ends, and then as soon as the application loads it is able to reload it. If there is any other information that is necessary to help you with me, then tell me! thank you in advanced! You can not save the int

You will not need to save it to < Code> NSNumber : Use

NSNumber * number = @ (myInt);

Then you can save it (when the app ends in the application of your app deli :) :):

  [[NSUserDefaults standard User default] set object: number forKey: @ "number"]; [[NSUserDefaults Standard User Defaults] Synchronize];  

To retrieve the value usage:

  NSNumber * number = [[NSUserDefaults standard standard default] stringForKey: @ "number"];  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -