From 99295cfb7ca89e99a1a158e2532dc94db6b9f3e5 Mon Sep 17 00:00:00 2001 From: Tobias Haeberle Date: Tue, 4 Jun 2013 23:40:16 +0200 Subject: [PATCH] Fix reverse usage of TTTISO8601DateTransformer The TTTISO8601DateTransformer has been used in the wrong direction: instead of converting from a string to a date, it tried to convert from a date to a string which fails silently everytime. --- AFIncrementalStore/AFRESTClient.m | 2 +- Examples/Twitter Client/Classes/AppDotNetAPIClient.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AFIncrementalStore/AFRESTClient.m b/AFIncrementalStore/AFRESTClient.m index e3a32b3..f69e1d7 100644 --- a/AFIncrementalStore/AFRESTClient.m +++ b/AFIncrementalStore/AFRESTClient.m @@ -180,7 +180,7 @@ - (NSDictionary *)attributesForRepresentation:(NSDictionary *)representation if ([(NSAttributeDescription *)obj attributeType] == NSDateAttributeType) { id value = [mutableAttributes valueForKey:key]; if (value && ![value isEqual:[NSNull null]] && [value isKindOfClass:[NSString class]]) { - [mutableAttributes setValue:[[NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName] transformedValue:value] forKey:key]; + [mutableAttributes setValue:[[NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName] reverseTransformedValue:value] forKey:key]; } } }]; diff --git a/Examples/Twitter Client/Classes/AppDotNetAPIClient.m b/Examples/Twitter Client/Classes/AppDotNetAPIClient.m index 1578b95..76daa5b 100644 --- a/Examples/Twitter Client/Classes/AppDotNetAPIClient.m +++ b/Examples/Twitter Client/Classes/AppDotNetAPIClient.m @@ -90,7 +90,7 @@ - (NSDictionary *)attributesForRepresentation:(NSDictionary *)representation NSMutableDictionary *mutablePropertyValues = [[super attributesForRepresentation:representation ofEntity:entity fromResponse:response] mutableCopy]; if ([entity.name isEqualToString:@"Post"]) { [mutablePropertyValues setValue:[NSNumber numberWithInteger:[[representation valueForKey:@"id"] integerValue]] forKey:@"postID"]; - [mutablePropertyValues setValue:[[NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName] transformedValue:[representation valueForKey:@"created_at"]] forKey:@"createdAt"]; + [mutablePropertyValues setValue:[[NSValueTransformer valueTransformerForName:TTTISO8601DateTransformerName] reverseTransformedValue:[representation valueForKey:@"created_at"]] forKey:@"createdAt"]; } else if ([entity.name isEqualToString:@"User"]) { [mutablePropertyValues setValue:[NSNumber numberWithInteger:[[representation valueForKey:@"id"] integerValue]] forKey:@"userID"]; [mutablePropertyValues setValue:[representation valueForKey:@"username"] forKey:@"username"];