- Fix Exception in PNObject ReverseMapping method
This commit is contained in:
1 parent
566019c57f
commit
437a3e8e47
2 files changed
+18
-18
No files matched your search
+17
-17
@@ -222,14 +222,7 @@ NSString * const PNObjectMappingSelector = @"selector";
|
||||
|
||||
@try {
|
||||
value = [self valueForKey:propertyName];
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
continue;
|
||||
}
|
||||
@finally {
|
||||
|
||||
//NSLog(@"PropertyName PropertyType Value: %@ - %@ - %@",propertyName,propertyType,value);
|
||||
|
||||
|
||||
((void (^)())@{
|
||||
@"c" : ^{
|
||||
char val = [value charValue];
|
||||
@@ -261,7 +254,7 @@ NSString * const PNObjectMappingSelector = @"selector";
|
||||
},
|
||||
@"NSURL" : ^{
|
||||
NSURL *url = value;
|
||||
|
||||
|
||||
if (![self isObjNull:url]) {
|
||||
[JSON setValue:[url absoluteString] forKey:propertyName];
|
||||
}
|
||||
@@ -285,37 +278,37 @@ NSString * const PNObjectMappingSelector = @"selector";
|
||||
@"NSArray" : ^{
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for(id object in value) {
|
||||
|
||||
|
||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
NSDictionary *objectDict = [(PNObject*) object reverseMapping];
|
||||
|
||||
|
||||
[arr addObject:objectDict];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[JSON setValue:arr forKey:propertyName];
|
||||
},
|
||||
@"NSMutableArray" : ^{
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for(id object in value) {
|
||||
|
||||
|
||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
NSDictionary *objectDict = [(PNObject*) object reverseMapping];
|
||||
|
||||
|
||||
[arr addObject:objectDict];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[JSON setValue:arr forKey:propertyName];
|
||||
}
|
||||
}[propertyType] ?: ^{
|
||||
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
|
||||
|
||||
NSDictionary *objectDict = [(PNObject*)value reverseMapping];
|
||||
|
||||
|
||||
[JSON setValue:objectDict forKey:propertyName];
|
||||
}
|
||||
else {
|
||||
@@ -323,6 +316,13 @@ NSString * const PNObjectMappingSelector = @"selector";
|
||||
}
|
||||
})();
|
||||
}
|
||||
@catch (NSException *exception) {
|
||||
continue;
|
||||
}
|
||||
@finally {
|
||||
|
||||
//NSLog(@"PropertyName PropertyType Value: %@ - %@ - %@",propertyName,propertyType,value);
|
||||
}
|
||||
}
|
||||
|
||||
return JSON;
|
||||
|
||||
Reference in new issue
Block a user