I want to edit an existing entry in the master data. At the moment I have this code, but it creates a new record (and inserts the correct data into the correct column):
NSManagedObjectContext *context = [[NSApp delegate] managedObjectContext];
NSManagedObject *instrument = nil;
instrument = [NSEntityDescription insertNewObjectForEntityForName: @"Instrument"
inManagedObjectContext: context];
[instrument setValue:[NSNumber numberWithInt:quantityInStockInstruments]
forKey: @"quantity"];
The result will look like this:
Instrument | Value | Quantity
Violin | £25 | 9
| | 8 <<< This is the new record that is created, instead of setting the
quantity of violin from '9' to '8'
I want the program to edit the column for the amount of the row currently selected (in this case, the row is “fiddle.” How would I do this?
source
share