Here is my first post on stackoverflow. Any of your help will be greatly appreciated!

I am totally new to ios development. As a practice, I am trying to develop a simple app that keeps track of diffrent items in my lab. Each item has a to-one relationship to its location and each location has a to-many relationship to different items.

I have a UITableViewController(LocationListTableViewController) that uses NSFectchedResultController as its data source for the tableview. The tableview controller is also conformed to NSFetchedResultController Delegate to keep all the NSManagedObject updated.

Once a location on the LocationListTableViewController is tapped, a DetailedTableViewController will be pushed and shows the items at that location. This DetailedTableViewController has an NSUndoManager instance variable to support canceling of changes. I use a NSMutableArray as the data source of the DetailedTableViewController:

NSSet *items = self.location.items;
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"itemName" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *array = [[items allObjects]sortedArrayUsingDescriptors:sortDescriptors];
// itemList is the data source for the table view
self.itemList = [array mutableCopy];

When the "Edit" button is tapped, Users can delete items and those item's location is set to nil. The deleted Items are transferred to a "changedItem" NSMutableArray so that the change can be canceled:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (!changedItems)
       changedItems = [[NSMutableArray alloc] init];

    // Set the company attribute of selected company to n
Edit
Report