Closed bontoJR closed 7 years ago
Hey @bontoJR. Thanks for reaching out about this. Someone will review what you've provided and follow-up soon with a solution or more questions.
It looks from the code that you've provided that you're attempting to use a number of internal Realm methods. These methods are implementation details of the Realm framework, are not intended to be used directly, and do not work in the manner that your code sample assumes they work (in particular, assigning to RLMRealm.schema
after opening the Realm isn't useful).
If you can provide more detail about what you're trying to do we can try to point you at a supported way to accomplish that goal.
I am trying to create a dynamic way to create Realms and schemes at runtime, that's why I ended up experimenting with these methods.
The goal is to have a JSContext defining the scheme, objects and properties, which will then be used to manage the data. The JSContext will act as "front-end" and the Realm in Obj-C as "back-end" inside the app itself. This is what I am trying to achieve right now.
Side Note: I can't use React Native.
We don't have any public support for creating schemas at runtime. If you want to rely on Realm internals, which are subject to change at any time, you can likely use -[RLMRealmConfiguration setCustomSchema:]
instead of -[RLMRealm setSchema:]
, and then pass the RLMRealmConfiguration
instance with the custom schema configured on it to +[RLMRealm realmWithConfiguration:error:]
. You can see examples of this in our unit tests.
Goals
I want to retrive objects created using dynamic Realm.
I am creating a test class using the dynamic features like this:
Then I later try to get the objects out of the Realm with:
and I get back the following error:
Expected Results
Objects should be returned. I have the feeling I am missing a step, so please let me know if I am missing something.
Actual Results
Error above.
Version of Realm and Tooling
Realm version: 2.5.0
Xcode version: 8.3.1
iOS/OSX version: 10.3