Andrespch
Andrespch

Reputation: 367

Realm Migration not working

I'm getting a crash on my App Store update, the migration is handled and even when I see the code Block is being executed I get the Following migration error

'RLMException', reason: 'Migration is required for object type 'LLCachedObject' due to the following errors: - Property 'resultType' has been added to latest object model.'

This is how I'm handling the Migration

[migration enumerateObjects:LLCachedObject.className
                      block:^(RLMObject *oldObject, RLMObject *newObject) {
                          if (oldSchemaVersion < 5) {
                              newObject[@"resultType"] = kLLResultTypeBrief;
                          }
                      }];

and I double-checked that the oldSchemaVersion was 4, and newObject[@"resultType"] is being set properly, this is happening on iOS 9, I'm completely clueless as I've run out of things to checked to find out what is causing this.

Upvotes: 1

Views: 831

Answers (1)

Andrespch
Andrespch

Reputation: 367

So the problem turned out being that we have another project we use for the same app that also has a Realm, we weren't aware that the migration needed to be handled in both sides, so what we are doing now is using the class subsets to specify the Model Clases that every project uses.

For more details https://realm.io/docs/objc/latest/#class-subsets

Upvotes: 1

Related Questions