- Fix NSDate in JSONFormObjectMathod

This commit is contained in:
Giuseppe Nucifora 2016-05-02 13:31:52 +02:00
parent 4eca983cf6
commit 3afa4a9459
2 changed files with 7 additions and 2 deletions

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "PNObject"
s.version = "0.8.0"
s.version = "0.8.1"
s.summary = "PNObject is a simple replica of the more complex ParseObject"
# This description is used to generate tags and improve search results.

View File

@ -348,13 +348,18 @@ NSString * const PNObjectMappingSelector = @"selector";
NSDictionary *JSONMap = [[self class] objcetMapping];
if (self.JSON && [[self.JSON allKeys] count] == 0) {
self.JSON = [self reverseMapping];
self.JSON = [[NSMutableDictionary alloc] initWithDictionary:[self reverseMapping]];
}
for (NSString *key in JSONMap) {
if ([self.JSON objectForKey:[JSONMap objectForKey:key]]) {
if ([[self.JSON objectForKey:[JSONMap objectForKey:key]] isKindOfClass:[NSDate class]]) {
[JSONFormObject setObject:[[[self.JSON objectForKey:[JSONMap objectForKey:key]] toGlobalTime] stringWithFormat:kNSDateHelperFormatSQLDateWithTime] forKey:[JSONMap objectForKey:key]];
}
else {
[JSONFormObject setObject:[self.JSON objectForKey:[JSONMap objectForKey:key]] forKey:[JSONMap objectForKey:key]];
}
}
}
return JSONFormObject;