rrbrambley / MessageBeast-ObjC

A library for building Message-based apps on App.net
MIT License
6 stars 0 forks source link

NSDate is failing as ordered dictionary key #38

Closed rrbrambley closed 10 years ago

rrbrambley commented 10 years ago

Dates are failing to evaluate as equal. It seems as though using NSNumber timeIntervalSince1970 could work, but that could look messy.

(lldb) p [(NSDate *)[channelMessages.allKeys objectAtIndex:0] timeIntervalSince1970]
(double) $2 = 1394469366.168542
(lldb) p [(NSDate *)[channelMessages.allKeys objectAtIndex:0] timeIntervalSince1970] == messagePlus.displayDate.timeIntervalSince1970
(bool) $3 = true
(lldb) p [(NSDate *)[channelMessages.allKeys objectAtIndex:0] isEqualToDate:messagePlus.displayDate]
(char) $4 = '\0'
(lldb) p [(NSDate *)[channelMessages.allKeys objectAtIndex:0] isEqual:messagePlus.displayDate]
(char) $6 = '\0'

This evaluates to YES:

[[NSNumber numberWithDouble:[(NSDate *)[channelMessages.allKeys objectAtIndex:0] timeIntervalSince1970]] isEqual:[NSNumber numberWithDouble:messagePlus.displayDate.timeIntervalSince1970]]

Is it possible to just use some other dictionary key? Sigh.

rrbrambley commented 10 years ago

Go back to using message IDs?