I'm trying to remove a property in one of my Realm objects however I'm not sure how to write a migration for this.
I just removed the property from my object's header file but that didn't work as I get this error:
Terminating app due to uncaught exception 'RLMException', reason: 'Migration is required for object type 'Stock' due to the following errors: - Property 'percentageOn' is missing from latest object model.'
I know how to write a migration add fields, but how do I remove one?
What David said is correct. If you make sure to perform a migration properly, then Realm can easily handle properties that have been removed as well as added. Unless you actually still need the value in
percentageOn, you can even leave the migration block empty like in the example on the Realm website: