Store a value beyond applicationWillTerminate

前端 未结 3 715
眼角桃花
眼角桃花 2020-12-12 06:39

I have searched in Apple\'s iOS dev center but couldn\'t find anything quite right. Here\'s my problem:

I have an app that uses CoreData with several entities. The d

相关标签:
3条回答
  • 2020-12-12 07:05

    Sounds like you want the NSUserDefaults storage. It's used like a dictionary, but persists:

    [[NSUserDefaults standardUserDefaults] setObject:myDate forKey:@"LastUpdateTime"];
    
    0 讨论(0)
  • 2020-12-12 07:13

    Swift 2.X Version

    NSUserDefaults.standardUserDefaults().setObject(NSDate(), forKey: "Last_Modified")
    
    0 讨论(0)
  • 2020-12-12 07:21

    Use NSUserDefaults to store the last update time.

    When your Updater is successful, write the success time to your apps defaults, that way it is accessible on your next launch, and you can call this anytime you to.

    0 讨论(0)
提交回复
热议问题