IOS: store an array with NSUserDefault

前端 未结 6 909
南旧
南旧 2021-02-06 05:58

I want to store an array with NSUserDefault, then, I put in applicationDidEnterBackground

[[NSUserDefaults standardUserDefaults] setObj         


        
6条回答
  •  执念已碎
    2021-02-06 06:55

    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.

提交回复
热议问题