objective c - Realm does not stored data in iOS -
i'm trying store data realm in ios i'm facing problem not stored data. found similar question i'm not sure how existing database.
why realm object not saving stored values?
here code.
@interface database : rlmobject @property nsstring *name; @property nsstring *age; @end @implementation database @end rlm_array_type(database)
in appdelegate.m
database *db = [[database alloc] init]; db.name = @"david test"; db.age = @"30"; [realm beginwritetransaction]; [realm addobject:db]; [realm commitwritetransaction];
then allobjects below
rlmresults *result = [database allobjects];
shutting down app once,rlmresults has no data.
does have idea?
thanks in advance!
is possible realm
variable you're using initialized +[rlmrealm realmwithpath:]
? [database allobjects]
call query default realm (created [rlmrealm defaultrealm]
).
although it's impossible certainty happening without more information.
Comments
Post a Comment