Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When calling performFetch I got the same EXC_BAD_ACCESS signal very deep in the system stack. Changes with cache or anything did not help.</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; managedContext = [appDelegate managedObjectContext]; NSError *error = nil; NSFetchedResultsController *frC = self.fetchedResultsController; if (![frC performFetch:&amp;error]) { /* */ } } </code></pre> <p>Lately I found one small snippet to add. Actually, problem was the way I had used iOS memory management (or did't had used). </p> <pre><code>- (NSFetchedResultsController *)fetchedResultsController { if (fetchedResultsController != nil) { return fetchedResultsController; } NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Asiakasrekisteri" inManagedObjectContext:managedContext]; [fetchRequest setEntity:entity]; [fetchRequest setFetchBatchSize:200]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"yritys" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; NSFetchedResultsController *aFetchedResultsController = [[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedContext sectionNameKeyPath:nil cacheName:nil] retain]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; return fetchedResultsController; } </code></pre> <p>aFetchedResultsController did have very short independent life, but it was deallocated before performFetch. A <strong>retain</strong> did help and resultscontroller kept allocated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload