Open zenghaojim33 opened 8 years ago
I have no idea. Can you run demo project directly?
OK I found the solution. In RBQObjectCacheObject.m file
+ (RLMObject *)objectInRealm:(RLMRealm *)realm
forCacheObject:(RBQObjectCacheObject *)cacheObject
{
if (cacheObject.primaryKeyType == RLMPropertyTypeString) {
return [realm objectWithClassName:cacheObject.className forPrimaryKey:cacheObject.primaryKeyStringValue];
}
else if (cacheObject.primaryKeyType == RLMPropertyTypeInt) {
NSNumber *numberFromString = @(cacheObject.primaryKeyStringValue.integerValue);
return [realm objectWithClassName:cacheObject.className forPrimaryKey:numberFromString];
}
else {
@throw ([self unsupportedPrimaryKeyTypeException]);
}
}
I change integerValue
to LonglongVaue
since my primary key number is long long
and it's very large so this causes some precision loses.
Ah, nice catch!
@zenghaojim33 can you submit PR with this change?
Sure.
I checked my code in RBQObjectCacheObject.m as longLongValue like here `+ (RLMObject )objectInRealm:(RLMRealm )realm forCacheObject:(RBQObjectCacheObject *)cacheObject { if (cacheObject.primaryKeyType == RLMPropertyTypeString) {
return [realm objectWithClassName:cacheObject.className forPrimaryKey:cacheObject.primaryKeyStringValue];
}
else if (cacheObject.primaryKeyType == RLMPropertyTypeInt) {
NSNumber *numberFromString = @(cacheObject.primaryKeyStringValue.longLongValue);
return [realm objectWithClassName:cacheObject.className forPrimaryKey:numberFromString];
}
else {
@throw ([self unsupportedPrimaryKeyTypeException]);
}
}`
but i still take this issue. Can you help me!
I used this library in my project and it works well on 64bit devices, but this bug happens on iPhone5 and iPhone4s. Basically I just copy codes from the demo project. Any idea what may cause this ? thanks in advance.