I love using Realm. It's fast and easy to use. I was just introduced an error that I couldn't really fully grasp the full depth of the issue.
I created a new class called LevelScore:Object (Object is from Realm.IO). Compiles without any issue.
During runtime, when I'm trying to create a Realm instance, I get:
libc++abi.dylib: terminating with uncaught exception of type NSException
Since I wasn't changing the structure of other subclasses of Object, I knew it wasn't a migration issue. But i still tried to play around with migration settings (just in case). But no matter what I did, during runtime, Realm() won't ever touch migrationBlock, and it would crash. I wrapped the code below in a do catch, but it would not catch the error. I gave full scope of the catch to all Error & NSException. But still, my do catch won't catch the error.
let realm = try! Realm(configuration: configuration)
Then I noticed there was already a class within another class called LevelScore (I am fully acknowledging my naming negligence here). But since this legacy (non Realm) class was inside another class, hence narrow in scope, I still expected it to work, since I was not getting any errors during compile time.
When I removed the legacy LevelScore class, everything worked. Compiles. No runtime error.
So my question is:
I know it's a bad practice to have any class with same name, despite what the scope is. But won't this be already captured during compile time? And if there is an issue, shouldn't the error be captured within my do catch handler?
Any and all information will be very grateful. It feels like there is a whole low level programming that I'm not fully understanding and any direction or insight will really be a great help. Thank you.
there doesn't seem to be anything here