How to: What's the optimum way of storing an NSDate in NSUserDefaults?
How to: What's the optimum way of storing an NSDate in NSUserDefaults?
What’s the optimum way of storing an NSDate in NSUserDefaults?
There’s two ways of storing an NSDate in NSUserDefaults that I’ve come across.
Option 1 – setObject:forKey:
// Set NSDate *myDate = [NSDate date]; [[NSUserDefaults standardUserDefaults] setObject:myDate forKey:@"myDateKey"]; // Get NSDate *myDate = (NSDate *)[[NSUserDefaults standardUserDefaults] objectForKey:@"myDateKey"];
Option 2…
View On WordPress













