Setting Core Data property value with float type
In a test iPhone app I am developing, I am trying to set the value of a float field in my Core Data model. The compiler is giving me an incompatible type error even though both the data type specified in my method is a float and the data type in model is a float.
This is the first project where I am using Core Data instead of SQLite 3.
- (void)insertNewObject:(NSString *)titleTxt withAmount:(float)amount andDueDate:(NSDate *)due {
[newManagedObject setValue:amount forKey:开发者_StackOverflow中文版@"amountDue"];
You'll have to make an NSNumber with the float.
精彩评论