[SGStorage] [iOS] Storing and retrieving dates in properties
5 views
Skip to first unread message
Warner Onstine
unread,
Jan 17, 2012, 11:32:53 AM1/17/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to simp...@googlegroups.com
I have tried a wide variety of things trying to get my dates out of the object passed back through my storage query. Here is the latest which is storing null in my NSManagedObject (if that makes a difference).
NSDateFormatter *dateFormat = [[[NSDateFormatter alloc] init] autorelease]; [dateFormat setDateFormat:@"EEE MMM DD hh:mm:ss ZZZ yyy"]; //when I spit out the property in a log message this is the string format I get back event.title = (NSString*)[record.properties objectForKey:kCREventTitleField]; event.eventDescription = (NSString*)[record.properties objectForKey:kCREventDescField]; event.startTime = (NSDate*)[dateFormat dateFromString:[record.properties objectForKey:kCREventStartTimeField]];
I can successfully spit out the date in a log message before trying to store it.
I've also tried: - storing as a date - casting as a date
The weird thing is that iOS will actually store it but as soon as I try and do anything with it it bombs (like formatting it to a string for a label creates a NIL object).
Any thoughts on what I should be doing? Can't find anything in the docs on what I might try.