0
我無法將日期格式化程序添加到序列化日期時使用的列表RKValueTransformers
,因爲RKObjectMapping's
初始化函數總是覆蓋它。無法爲RestKit對象映射序列化設置默認的NSDateFormatter
基本上在我的應用程序didFinishLaunching
我有以下代碼:
// Survey Mapping Mapping
RKEntityMapping * surveyRequestMapping = [RKObjectMapping requestMapping];;
[surveyRequestMapping addAttributeMappingsFromArray:@[@"key", @"version"]];
// Add a request descriptor for Surveys
[sharedManager addRequestDescriptor:
[RKRequestDescriptor requestDescriptorWithMapping:surveyRequestMapping
objectClass:[Survey class]
rootKeyPath:nil
method:RKRequestMethodAny]];
// Update date format so that we can parse dates properly.
// 2013-11-09 14:51:27 +0000
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss Z";
[[RKValueTransformer defaultValueTransformer] insertValueTransformer:dateFormatter atIndex:0];
一旦我註釋掉以下行我NSDateFormatter
使用。 https://github.com/RestKit/RestKit/blob/development/Code/ObjectMapping/RKObjectMapping.m#L140
我做錯了什麼嗎?
我將'insertValueTransformer'調用移到創建我的RKEntityMapping的代碼段後面,並且得到相同的錯誤。我已更新我的問題以包含我的EntityMapping代碼。 – Wolfsokta