Reputation: 18464
I follow the Restkit wiki and succeed to parse ASP.NET date to NSDate. But I cannot set the default output, whatever I do, it still outputs as the following format: "2010-01-27 00:00:00 +0000".
Here is what I try
[RKObjectMapping addDefaultDateFormatter:[RKDotNetDateFormatter dotNetDateFormatter]];
NSDateFormatter *dateFormatter = [NSDateFormatter new];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
// Set it Globally
[RKObjectMapping setPreferredDateFormatter:dateFormatter];
If you have any ideas, please let me know.
Thank you.
Upvotes: 1
Views: 223
Reputation: 71
I ran into this same problem and tracked it down to an initialize() method in RKObjectMapping.m where it inserts an RKISO8601DateFormatter at the top of the list. Once I commented out that line my custom date formatter was used.
https://github.com/RestKit/RestKit/blob/development/Code/ObjectMapping/RKObjectMapping.m#L140
I've opened a defect with RestKit but I could just be missing something. https://github.com/RestKit/RestKit/issues/1753
Hope this helps you.
Upvotes: 1