Skip to content
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

Realm 0.85 has primary key support and does not allow it to change #11

Closed
wants to merge 2 commits into from

Conversation

johanforssell
Copy link

This updates Realm-JSON to use Realm 0.85.

As this Realm version supports primary keys I needed to add a control when adding data in -mc_setValuesFromJSONDictionary:inRealm: so that it's not trying to write new data for a primary key.

I've not checked my solution thoroughly, but it's a suggestion as to what needs to be done to solve this problem.

@matthewcheok
Copy link
Owner

Hi Johan, it seems the official implementation of primary keys is rather similar to Realm+JSON. What problems are you experiencing exactly?

@matthewcheok
Copy link
Owner

Alright I see the issue now. I'd prefer to drop pre-existing support for primary keys and adopt the official one. Thanks for bringing this to my attention.

@matthewcheok
Copy link
Owner

Resolved. Note breaking change.

@johanforssell
Copy link
Author

I find that you now have to wrap -createOrUpdateInRealm:withJSONDictionary: in [realm beginWriteTransaction]; and [realm commitWriteTransaction];. You should perhaps make a note of this in the Readme?

#1  0x0000000106c4c28a in RLMVerifyInWriteTransaction(RLMRealm*) at Pods/Realm/Realm/RLMObjectStore.mm:217
#2  0x0000000106c4c940 in RLMCreateObjectInRealmWithValue(RLMRealm*, NSString*, objc_object*, bool) at Pods/Realm/Realm/RLMObjectStore.mm:322
#3  0x0000000106c40e4a in +[RLMObject createInRealm:withObject:] at Pods/Realm/Realm/RLMObject.mm:94

@matthewcheok
Copy link
Owner

Again, good catch. Updated README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants