I love using Realm. It's quick and easy to use. I was just introduced an error that I could not fully understand in depth of the problem.
I created a new class called LevelScore: Object (Object is from Realm.IO). Compilates without problems.
During runtime, when I try to create a Realm instance, I get:
libc ++ abi.dylib: ending with uncaught except for type NSException
Since I was not Changing the structure of other subclasses of Objects I knew it was not a migration problem. But I still tried to play with migration settings (just in case). But whatever I did, during Runtime, Realm () will not ever touch migration Block, and it would crash. I packed the code under a do-catch, but that would not make the mistake. I gave full extent of the catch to all errors and NSException. But still my catch will not catch the mistake.
Then I noticed that there was already a class in another class, called LevelScore (I fully acknowledge my naming negligence here). But since this legacy (non-Realm) class was in another class, therefore narrow in scope, I still expected it to work since I did not get any errors during compilation.
When I removed the older LevelScore class, everything worked. Compiles. No runtime wrong.
So my question is:
I know it's a bad exercise to have some class with the same name, regardless of what the size is. But will not this already be taken during compilation? And if that's a problem, should not the error be caught in my catch-handle?
All and all information will be very grateful. It feels like it's a very low level of programming that I do not fully understand and which direction or insight will really be a big help. Thanks.