Home Ask Login Register

Developers Planet

Your answer is one click away!

Mohanraj February 2016

I am just tring to create a DEFAULT RMRealm but still crashes

 Terminating app due to uncaught exception 'RLMException', reason: ''NSMutableArray' is not supported as an RLMObject property. All properties must be primitives, NSString, NSDate, NSData, RLMArray, or subclasses of RLMObject.

Any help please. i dont know how to include it as RLMArray

NSDictionary *res = [NSJSONSerialization JSONObjectWithData:self.responseData options:NSJSONReadingMutableLeaves error:&myError];
 //  NSLog(@"%@",res);

for (NSDictionary *collectionDict in [res objectForKey:@"pois"])
    RLMRealm *defaultREALM=[RLMRealm defaultRealm];
    [defaultREALM beginWriteTransaction];
    NSMutableDictionary *mCollectionDict = [collectionDict mutableCopy];
    mCollectionDict[@"Firstname"] = collectionDict[@"name"];
    [mCollectionDict removeObjectForKey:@"name"];
    [defaultREALM commitWriteTransaction];


TiM February 2016

From what I can gather in your sample, you're trying to serialize a JSON stream and then pass it to Realm. There's unfortunately an NSArray in there somewhere which Realm cannot accept.

Normally it would be necessary for you to manually process the contents of the dictionary to make sure every value in it is compatible with your Realm model. Luckily, there's a third party library available that can handle that for you. I definitely recommend checking out Realm-JSON for this situation. :)

Post Status

Asked in February 2016
Viewed 3,301 times
Voted 7
Answered 1 times


Leave an answer

Quote of the day: live life