The following code, heavily inspired by some example that I found on the network, seems to work fine, with a main data object called "Contact" and a property called "address" with a String attribute in xcdatamodel. This saves my data without any problems. Now my question is: how do I change this code? To make it work after I changed the property attribute "address" from String to Float to xcdatamodel.
CoreDataTestOneAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; NSManagedObjectContext *context = [appDelegate managedObjectContext]; NSManagedObject *newContact; newContact = [NSEntityDescription insertNewObjectForEntityForName:@"Contacts" inManagedObjectContext:context]; [newContact setValue:address_InputField.text forKey:@"address"]; NSError *error; [context save:&error];
source share