From 6f2f24a5336001942f60c4f041496c2ab14d64df Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Mon, 18 Apr 2016 12:50:28 +0200 Subject: [PATCH] - Fix vari --- PNObject.podspec | 2 +- Pod/Classes/PNObject+Protected.m | 4 ++-- Pod/Classes/PNObject.m | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/PNObject.podspec b/PNObject.podspec index cf96b5a..98c006b 100644 --- a/PNObject.podspec +++ b/PNObject.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "PNObject" -s.version = "0.6.1" +s.version = "0.6.2" s.summary = "PNObject is a simple replica of the more complex ParseObject" # This description is used to generate tags and improve search results. diff --git a/Pod/Classes/PNObject+Protected.m b/Pod/Classes/PNObject+Protected.m index c05d833..c5ca963 100644 --- a/Pod/Classes/PNObject+Protected.m +++ b/Pod/Classes/PNObject+Protected.m @@ -128,7 +128,7 @@ @"NSArray" : ^{ NSMutableArray *arr = [NSMutableArray array]; for(id JSONObject in value) { - if([[JSONObject class] isSubclassOfClass:[PNObject class]]) { + if(fromLocal || [[JSONObject class] isSubclassOfClass:[PNObject class]] || [NSClassFromString(mappedJSONType) isSubclassOfClass:[PNObject class]]) { PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject fromLocal:fromLocal]; [arr addObject:val]; } @@ -142,7 +142,7 @@ @"NSMutableArray" : ^{ NSMutableArray *arr = [NSMutableArray array]; for(id JSONObject in value) { - if([[JSONObject class] isSubclassOfClass:[PNObject class]]) { + if(fromLocal || [[JSONObject class] isSubclassOfClass:[PNObject class]] || [NSClassFromString(mappedJSONType) isSubclassOfClass:[PNObject class]]) { PNObject *val = [[NSClassFromString(mappedJSONType) alloc] initWithJSON:JSONObject fromLocal:fromLocal]; [arr addObject:val]; } diff --git a/Pod/Classes/PNObject.m b/Pod/Classes/PNObject.m index 822d685..c12bdfa 100644 --- a/Pod/Classes/PNObject.m +++ b/Pod/Classes/PNObject.m @@ -291,6 +291,9 @@ NSString * const PNObjectMappingSelector = @"selector"; [arr addObject:objectDict]; } + else { + [arr addObject:object]; + } } [JSON setValue:arr forKey:propertyName]; @@ -305,6 +308,9 @@ NSString * const PNObjectMappingSelector = @"selector"; [arr addObject:objectDict]; } + else { + [arr addObject:object]; + } } [JSON setValue:arr forKey:propertyName]; @@ -319,6 +325,7 @@ NSString * const PNObjectMappingSelector = @"selector"; } else { // do nothing + [JSON setValue:value forKey:propertyName]; } })(); }