I have to store large numbers in Realm
storage like 14000822124935161134
. Currently I store them by changing the type of them to string
as follows and then save it:
NSMutableDictionary *itemInsert = [item mutableCopy];
if([item valueForKey:@"timestamp"]) {
unsigned long long timestamp = [[item valueForKey:@"timestamp"] unsignedLongLongValue];
[itemInsert setObject:[NSString stringWithFormat:@"%llu", timestamp] forKey:@"timestamp"];
}
RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
[RMember createOrUpdateInRealm:realm withValue:itemInsert];
[realm commitWriteTransaction];
And the timestamp
property of my RLMObject
is defined as follows :
@interface RMember : RLMObject
...
@property (nullable) NSString *timestamp;
...
@end
Is there any suitable type rather than string
for this type of data in Realm
or any better solution?