假设我有这个 Json :
{ "arrayOfDates" : [ "7-28-2013", "7-29-2013", "7-30-2013"]}
我的目标是:
@interface MyObject : NSObject
@property (nonatomic, retain) NSArray* dates;
@end
我试图用日期映射 arrayOfDates。
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[MyObject class]];
[mapping addAttributeMappingsFromDictionary:@{@"arrayOfDates" : @"dates"}];
NSDateFormatter *dateFormatter = [NSDateFormatter new];
[dateFormatter setDateFormat:@"MM-dd-yyyy"];
mapping.preferredDateFormatter = dateFormatter;
映射结果是一个 NSString 数组!这是获取 NSDate 数组而不是 NSString 的方法吗?