ios - I am just tring to create a DEFAULT RMRealm but still crashes -
terminating app due uncaught exception 'rlmexception', reason: ''nsmutablearray' not supported rlmobject property. properties must primitives, nsstring, nsdate, nsdata, rlmarray, or subclasses of rlmobject.
any please. dont know how include rlmarray
nsdictionary *res = [nsjsonserialization jsonobjectwithdata:self.responsedata options:nsjsonreadingmutableleaves error:&myerror]; // nslog(@"%@",res); (nsdictionary *collectiondict in [res objectforkey:@"pois"]) { rlmrealm *defaultrealm=[rlmrealm defaultrealm]; [defaultrealm beginwritetransaction]; nsmutabledictionary *mcollectiondict = [collectiondict mutablecopy]; mcollectiondict[@"firstname"] = collectiondict[@"name"]; [mcollectiondict removeobjectforkey:@"name"]; nslog(@"%@===>%@",collectiondict,collectiondict[@"name"]); [defaultrealm commitwritetransaction]; }
from can gather in sample, you're trying serialize json stream , pass realm. there's unfortunately nsarray
in there somewhere realm cannot accept.
normally necessary manually process contents of dictionary make sure every value in compatible realm model. luckily, there's third party library available can handle you. recommend checking out realm-json
situation. :)
Comments
Post a Comment