Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Owner and Founder. Opencart
Realm is a cross-platform mobile database solution designed for mobile applications. It’s fast, lightweight, and quite simple to integrate into your project. Furthermore, it doesn’t rely on Core Data or a SQLite database. The Realm developers claim that their data storage solution is faster than SQLiteas well as Core Data.
When we modified our model’s properties to store data in realm database then app get crashed and Xcode’s console output told us Migration is required due to the following errors:. In order to solve this issue, We need to add migration to our project.
Migration is required due to the following errors:
Our app crashes because there is a mismatch between what we define in code and the data exists on disk if we had saved any data with the older model version. When this happens, an exception will be thrown when we try to open the existing file. The solution is to define a migration and the associated schema version by creating a Realm.Configuration instance.
The migration block provides all the logic for converting data models from old schemas to the new schema.
We have a data model that stores a user in Realm Database
Then if you have to make some changes in user’s properties
Because our previous model version doesn’t have the email property, we can do the migration by calling Migration‘s enumerateObjects method within the migration block and assign an empty email string to the existing data.
Secondly, we want to rename the name property to fullName. The migration can be done by increasing the schema version and invoking Migration‘s renameProperty method inside the migration block. It’s important to make sure that the new models have a property with the new name and don’t have a property with the old name.
Finally, we would like to separate the fullName property into firstName and lastName. We enumerate each User and apply any necessary migration logic. Don’t forget to increase the schema version as well.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Excellent work, fast, good quality and understood the brief perfectly! Quick responses developing the project and very good cooperation. I suggest to anyone.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.