When you build a model, the parsed file contains keywords in the UI, such as Id,description,self
There are 2 workarounds.
1. Change a name as the name of the member variable, assign a value to the member variable, but this method is not very convenient, when the variable name too much writing will be inconvenient.
2. Of course there are ways to write less code,
Call SetDescription when assigning a value to _mydescription:
@property (nonatomic,copy,setter=setdescription:) NSString * mydescription;
-(void) SetValue: (ID) value Forundefinedkey: (NSString *) key
{
If there is a key named description in the dictionary, but a property named description cannot be defined in the class, you can define the value Mydescription store description
if ([Key isequaltostring:@ "description"]) {
Self. Mydescription=value;
}
NSLog (@ "%@", key);
}
This is used when [model Setvaluesforkeyswithdictionary:dic];
The DIC key corresponds to the member variable name in the model, and the value is the value to be assigned; This method assigns the name of the member variable in the dictionary model to the model with the same value as the DIC key name.
Workaround to create a model when a member variable name conflict occurs