Here is my Story Board and the homeSegue Identifier : 

![Story Board .. Segue Identifier is highlighted](https://i.stack.imgur.com/bDmNc.png)

Here is the code block from where i am getting back to the previous viewController :

```
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    if([segue.identifier isEqualToString:@"homeSegue"]){
        ProductScannerViewController *product_scannerViewController = segue.destinationViewController;
        product_scannerViewController.delegate=self;

    }

    if([segue.identifier isEqualToString:@"scanSegue"]){

        [self.navigationController popToRootViewControllerAnimated:YES];

    }

}

```

It's returning me to the ScanProductViewController. But When i am trying to click the search button again from the ScanProductViewController I am getting the following exception :

```
 2014-05-03 16:05:51.349 Spisrett[5239:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'Product''
*** First throw call stack:
(
    0   CoreFoundation                      0x021d71e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib   

```

Please suggest me how can i return to ScanViewController without changing it's previous behaviour.

Thanks

Here is the method in which it's crashing .. Please suggest :

```
-(void) configureFetchedResultsController:(NSString *) tableType;
 {
  //NSLog(@"This is the table tyoe");
  //NSLog(tableType);

tableType=@"Product";
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription 
                               entityForName:tableType inManagedObjectContext:self.context];
[fetchRequest setEntity:entity];
//Sorted by -Ishtiak
NSString *sortColumn=@"productTitle";

//actual sort.....  decidedShortingColumn

NSSortDescriptor *sort = [[NSSortDescriptor alloc]
                          initWithKey:sortColumn ascending:YES];

[fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
[fetchRequest setFetchBatchSize:20];

NSFetchedResultsController *theFetchedResultsController = 
[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest 
                                        managedObjectContext:self.context
                                        sectionNameKeyPath:nil 
                                               cacheName:nil];

fetchedResultsController = theFetchedResultsController;
fetchedResultsController.delegate = self;

```

}