Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a type of a realm model property in Objective c?

I have a RLMObject in my Objective-c. I defined a property like:

 @property (assign, nonatomic) NSString *name;
 @property (assign, nonatomic) NSString *code;
 @property (assign, nonatomic) int day;
 @property (assign, nonatomic) int status;

But now, I need change the type of property code to int like:

 @property (assign, nonatomic) int code;

If I change this, then when I try access to the model I get an error showing that type was NSString and now int.

How can I change the property without reinstall my app?

like image 426
user3745888 Avatar asked Dec 08 '25 16:12

user3745888


1 Answers

You need to perform a migration so the data in the database fits the new data model. Please check the Migrations section of the Realm documentation.

like image 64
Adam Avatar answered Dec 10 '25 06:12

Adam