iOS Stackmob SDK(2.0.0) (relationships) Bug -


i have found critical bug relationships. try set relationship smusermanagedobject after saving in block "saveonsuccess" , have crash log:

* terminating app due uncaught exception 'smexceptionincompatibleobject', reason: 'no attribute found entity user maps primary key on stackmob. attribute name should match 1 of following formats: lowercasedentitynameid or lowercasedentityname_id. if managed object subclass user inherits smusermanagedobject, meaning intended define user objects, may return either of above formats or whatever lowercase string optional underscores matches primary key field on stackmob.' it's looks like:

nsmanagedobjectcontext *context = [[[smclient defaultclient] coredatastore] contextforcurrentthread]; user *user = [[user alloc] initnewuserincontext:context];  [user setusername:@"username1"]; [context saveonsuccess:^{ user.group = group; //an created object <--- have crash } onfailure:^{ }]; 

after "group" schema spoiled. attempts failure. if try set in other place like:

user.group = group; //before using saveonsuccess trick line work perfectly! 

i have crash. need remove "group" scheme @ stackmob "schema configuration" repair. so, can't create user object presetted relationship.

you can 1 of 2 things...

change user class inherit smusermanagedobject. see smusermanagedobject section in stackmob core data guide.

or in user class define selector returns name of primary key field:

- (nsstring *)primarykeyfield {     return @"username"; } 

Comments