I want to store an array with NSUserDefault, then, I put in applicationDidEnterBackground
NSUserDefault
applicationDidEnterBackground
[[NSUserDefaults standardUserDefaults] setObj
The previous answers are all correct, but note that neither applicationDidEnterBackground nor applicationWillTerminate are guaranteed to be called in all situations. You are usually better off storing important data whenever it has changed.
applicationWillTerminate