Realm object has been deleted or invalidated Realm object has been deleted or invalidated ios ios

Realm object has been deleted or invalidated


You can check if an object has been deleted from the Realm by calling object.invalidated -- if it returns true, then it has been deleted or the Realm has manually invalidated.


I got a really nice way to catch a RLMException within Swift.

Currently Swift doesn't show where a RLMException happened.

In Realm/RLMUtil.mm:266, there is the definition for RLMException.

If you change the code to generate a swift error,

Xcode now can show you where the exception occurred.

Now it is a part of Swift.

// Realm/RLMUtil.mm:266static NSException *RLMException(NSString *reason, NSDictionary *additionalUserInfo) {    // add some code to generate a swift error. E.g. division-by-zero.    int a = 0;    if (reason == nil) {        a = 1;    }    NSLog(@"calculating 1 / %d = %f", a, 1 / a);    ... remainder of the original code...}


I've just place breakpoint inside method:

// Realm/RLMUtil.mm:193static NSException *RLMException(NSString *reason, NSDictionary *additionalUserInfo) {    // ...}

And on left panel you can check stack trace, here you can find where error throws.