Closed tuantm2014 closed 9 years ago
That's because you haven't defined the mapping for stringValue
:
@interface RealmString : RLMObject
@property NSString *stringValue;
@end
@implementation RealmString
+ (NSDictionary *)JSONInboundMappingDictionary {
return @{
@"self": @"stringValue",
};
}
@end
Thanks @matthewcheok but it seems not work. It still crash at line 190 of RLMObject+JSON.m
for (id item in(NSArray*) value) {
[array addObject:[elementClass mc_createObjectFromJSONDictionary:item]];
}
Because item
is type of NSString
not NSDictionary
Your issue looks very similar to matthewcheok/Realm-JSON#4 Mind sharing your code sample?
Oh, it works now after clean database and project. Thanks so much @matthewcheok
Does anyone know how to parse an array of string. Like this:
We have a zoneInfo object that contains a tariffInfoLines array. This tariffInfoLines array contains strings. To store in Realm, i define RealmString object and store it in RLMArray
But i dont know how to parse it from JSON using Realm-JSON. The application will crash if you try to. So i really need some help to solve this problem!