mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 20:31:13 +08:00
Add support and test coverage for serializing Boolean properties to JSON as true/false instead of numbers. closes #920, #827
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
#import "RKObjectUtilities.h"
|
||||
#import "RKMacros.h"
|
||||
|
||||
RK_FIX_CATEGORY_BUG(RKPropertyInspector_CoreData)
|
||||
|
||||
// Set Logging Component
|
||||
#undef RKLogComponent
|
||||
#define RKLogComponent RKlcl_cRestKitCoreData
|
||||
@@ -89,3 +87,24 @@ RK_FIX_CATEGORY_BUG(RKPropertyInspector_CoreData)
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface NSManagedObject (RKPropertyInspection)
|
||||
- (Class)rk_classForPropertyAtKeyPath:(NSString *)keyPath;
|
||||
@end
|
||||
|
||||
@implementation NSManagedObject (RKPropertyInspection)
|
||||
|
||||
- (Class)rk_classForPropertyAtKeyPath:(NSString *)keyPath
|
||||
{
|
||||
NSArray *components = [keyPath componentsSeparatedByString:@"."];
|
||||
Class propertyClass = [self class];
|
||||
for (NSString *property in components) {
|
||||
propertyClass = [[RKPropertyInspector sharedInspector] classForPropertyNamed:property ofEntity:[self entity]];
|
||||
propertyClass = propertyClass ?: [[RKPropertyInspector sharedInspector] classForPropertyNamed:property ofClass:propertyClass];
|
||||
if (! propertyClass) break;
|
||||
}
|
||||
|
||||
return propertyClass;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user