NSFetchedResultsController and BAD_ACCESS

I have UITableViewControllerone that is served using NSFetchedResultsController.

Everything worked fine until I added

if (self.fetchedResultsController != nil) 
{
  return self.fetchedResultsController;
} 

at the beginning of my

-(NSFetchedResultsController *)fetchedResultsController { 

method. The error I am getting is:

Program received signal:  "EXC_BAD_ACCESS".

Any idea why this could be? I announce

@property (nonatomic, retain) NSFetchedResultsController  *fetchedResultsController; 

in the .h file and

@synthesize fetchedResultsController 

in the implementation file.

Thanks ~

+3
source share
2 answers

Is this setting up a recursive call with self.fetchedResultsController calling the fetchedResultsController?

+4
source

It looks like you are referencing an uninitialized pointer. Have you initialized fetchedResultsController? In the init class method, add:

fetchedResultsController = nil;

Does it help?

0

Source: https://habr.com/ru/post/1762104/


All Articles