-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking Object attributes don't exist when not in realm #4195
Comments
I verified the behavior changed from 1.0.2 to 2.0.2. Accessing an unmanaged RLMObject's linking object properties in 1.0.2 results in an empty RLMResults, but in 2.0.2 you get this exception:
As a workaround, using "count" appears to still work (returns 0 if not in a realm already). I will be wrapping all my iterators in this unless this is fixed... |
The EXC_BAD_ACCESS appears to occurs in RLMCollection.m:95:
|
Thanks for the detailed bug report. I was able to reproduce this by adding a new test case in Realm: PersonObject *don = [[PersonObject alloc] initWithValue:@[ @"Don", @60 ]];
XCTAssertEqualObjects(asArray(don.parents), (@[ ]));
for (PersonObject *parent in don.parents) {
(void)parent;
XCTFail();
} |
Hey I still appear to be having this issue. Using version class User: Object, Resource {
dynamic var id: String? = nil
dynamic var email: String? = nil
dynamic var firstName: String? = nil
dynamic var lastName: String? = nil
dynamic var phone: String? = nil
dynamic var company: String? = nil
var organisations = List<Organisation>()
let sessions = LinkingObjects(fromType: Session.self, property: "user")
My linking objects is empty outputting my override var description: String {
print("self.sessions: \(self.sessions)") Until I add all the 'sessions' which should fulfil the linkage to a Realm, then the debug output works fine. |
On further investigation it appears |
Correct, In the future, please file a new issue rather than tacking your question onto an issue that's been closed for many months. |
@bdash so be it. I thought you'd prefer to keep issues to a minimum! |
Upgraded to Realm 2.0.1 from 1.X and been having some crashes when adding new objects.
It looks like an object with linking properties crashes if i try to access its linking objects before it's added to realm. I think in 1.X the behavior was to return an empty list.
Did this behavior change? What's expected here:?
The text was updated successfully, but these errors were encountered: