Question

I have changed my Core Data model a bit (set some attributes as optional and non-optional).

Unfortunately I did not turn automatic versioning on...

I have uploaded my App to the App Store yesterday and it is still under review by Apple. I am afraid that it will break existing installations of my app.

This is why I would like to cancel my currently uploaded Binary and reset my Core Data model to the previous attributes settings and then upload the App again.

This leads me to the following questions:

  • How is determined if the current data model is compatible with the existing one? Is this being done purely on a comparison of attributes or by comparing the systemVersion in the contents file of the Core Data model?
  • How can I solve my problem and avoid that the new version of my App
    will lead to crashes due to an incompatible data model
Was it helpful?

Solution

Compatible versions are determined by matching version numbers.

Solve by doing exactly what you propose. Pull the binary, revert your changes, version the model, remake your changes, ensure that auto-migration is enabled and test that it works correctly.

The version number is created by generating a 32-byte hash digest of the components which are compared for equality:

  • For each entity the following attributes must be equal: name, parent, isAbstract, and properties. className, userInfo, and validation predicates are not compared.

  • For each property in each entity, the following attributes must be equal: name, isOptional, isTransient, isReadOnly, for attributes attributeType, and for relationships destinationEntity, minCount, maxCount, deleteRule, and inverseRelationship. userInfo and validation predicates are not compared.

Apple ref

Technically, if you don't change anything that doesn't affect the version number then you don't need to version the model. Note that your change will impact the version number so you do need to take action.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top