# Objective-c kvc automatic conversion type
Apple is very kind. During the time of KVC, we made some type conversions and posted the rules for your reference.
@ Interface entity: nsobject @ property (nonatomic, copy) nsstring * STR; @ property (nonatomic, assign) int I1; @ property (nonatomic, assign) int I2; @ property (nonatomic, assign) int I3; @ property (nonatomic, assign) float F1; @ property (nonatomic, strong) nsnumber * num; @ property (nonatomic, assign) bool B1; @ property (nonatomic, assign) bool B2; @ property (nonatomic, assign) bool B3; @ property (nonatomic, strong) nsdate * date1; @ property (nonatomic, assign) nstimeinterval T1; @ end // The value string can be converted to the value type [OBJ setvalue: @ "2.4" forkey: @ "I1"]; // a non-numeric string does not recognize [OBJ setvalue: @ "A" forkey: @ "I2"]; // only recognizes the previous number of special characters [OBJ setvalue: @ "2014 10-24" forkey: @ "I3"]; // This conversion used to be nsnumber type [OBJ setvalue: @ 1 forkey: @ "str"]; [OBJ setvalue: @ 1.23 forkey: @ "f1"]; // returns an nsstring [OBJ setvalue: @ "99" forkey: @ "num"]; //> = 1.0 true, false [OBJ setvalue: @ 1.0 forkey: @ "B1"]; //> = 0.9 true, false [OBJ setvalue: @ "1.1" forkey: @ "B2"]; // true yes False false NO can recognize [OBJ setvalue: @ "true" forkey: @ "B3"]; // convert to nstring [OBJ setvalue: @ "2014-10-24" forkey: @ "date1"]; // do not know [OBJ setvalue: @ "2014-10-24" forkey: @ "T1"]; // conclusion // a numeric string to a numeric value can be converted into a numeric value. // a class to class is directly assigned without conversion.
Study on Automatic Conversion Type of objective-C KVC