Are you sure that the startDateTime
instance variables of the node events are non-nil?
If you don't have one already, you might add a (custom) -description
method to your node event objects that does something like this:
- (NSString *)description {
return [NSString stringWithFormat:@"%@ - %@",
[super description], startDateTime]];
}
Then in your sorting code log the array before and after:
NSLog(@"nodeEventArray == %@", nodeEventArray);
NSSortDescriptor *dateDescriptor = [NSSortDescriptor
sortDescriptorWithKey:@"startDateTime"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:dateDescriptor];
NSArray *sortedEventArray = [nodeEventArray
sortedArrayUsingDescriptors:sortDescriptors];
NSLog(@"sortedEventArray == %@", sortedEventArray);
If the startDateTime
's are all nil
, then the before and after arrays will have the same order (since the sorting operation will equate to sending all the -compare:
messages to nil
, which basically does nothing).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…