I am trying to copy a NSManagedObject that holds a core data instance, but I am being some very weird behaviours when doing so, its like the objects are somehow linked to each other after the copy and changes to one also affects the other.
NSManagedObject *originalTransactionRow = [self.transactionRowsRows objectAtIndex:indexPath.row];
NSManagedObject *originalTransactionHeader = [self.transactionRowsHeader objectAtIndex:0];
NSString *originalOrderNumberLocalStr = [originalTransactionRow valueForKey:@"orderNumber"];
NSString *returnOrderNumber = [NWTillHelper getNewOrderNumber];
NSManagedObject *returnOrderHeader = nil;
NSManagedObject *returnOrderRow = nil;
returnOrderHeader = [NSEntityDescription insertNewObjectForEntityForName:@"OrderHead" inManagedObjectContext:context];
returnOrderRow = [NSEntityDescription insertNewObjectForEntityForName:@"OrderRow" inManagedObjectContext:context];
returnOrderHeader = originalTransactionHeader;
returnOrderRow = originalTransactionRow;
NSError *error = nil;
if(![context save:&error]) {
if([NWTillHelper isDebug] == 1) {
NSLog(@"Can't Delete! %@ %@", error, [error localizedDescription]);
return;
}
}