Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7043553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:18:13+00:00 2026-05-28T02:18:13+00:00

I’m making an app that has a view with UITableView with UISearchDisplayController . Data

  • 0

I’m making an app that has a view with UITableView with UISearchDisplayController. Data comes from NSFetchedResultsController. All is working fine: I get the data, table view is being populated, search works great. The only problem is that if I search and then click on “Cancel”(without deleting the text from the UISearchBar) and then go back to previous view controller and then go to that same view with UITableView and UISearchDisplayController it crashes with this being written to the log:

2012-01-06 16:46:37.559 MyApp[9586:207] *** -[SomeRandomViewController
controllerWillChangeContent:]: message sent to deallocated instance
0x778d060

I’ve googled and stackoverflowed for that error, tried to release NSFetchedResultsController variable, did set it and its’ delegate to nil, but nothing helps.

And if I do some search, then delete the text from the search bar and then tap on “Back” and go back to that view it works just fine.

A bit of the code:

- (void)viewDidUnload {
  [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
  [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];

  self.fetchedResultsController = nil;
  self.searchFetchedRC = nil;
  [super viewDidUnload];
}

- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller {

  self.fetchedResultsController = nil;
  [self fetchedResultsController];
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
  self.searchDisplayController.searchBar.text = @"";
  self.searchDisplayController.active = NO;
  [self searchDisplayControllerWillEndSearch:self.searchDisplayController];
  return YES;
}

Any help will be appreciated

Update

Without zombies the output to the log is:

2012-01-09 09:25:48.128 Butane[17325:207]
-[UITextMagnifierTimeWeightedPoint controllerWillChangeContent:]: unrecognized selector sent to instance 0x8251dc0

Update 2

Dealloc method:

- (void)dealloc {
  [self.mySearchDisplayController release];
  self.mySearchDisplayController.delegate = nil;
  self.mySearchDisplayController = nil;
  [self.fetchedResultsController release];
  self.fetchedResultsController.delegate = nil;
  self.fetchedResultsController = nil;
  [self.searchFetchedRC release];
  self.searchFetchedRC.delegate = nil;
  self.searchFetchedRC = nil;
  [self.tableView release];
  [textView release];
  self.tableView = nil;
  self.tableView.delegate = nil;
  [super dealloc];
}

mySearchDisplayController = UISearchDisplayController

fetchedResultsController and searchFetchedRC = NSFetchedResultsControllers

tableView = UITableView

textView = [HPGrowingTextView][1]

Update 3

Inspired by the answer of Tia I’ve set FRCs and their delegates to nil in searchDisplayControllerWillEndSearch method. Works so far so good

- (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller {

  self.fetchedResultsController.delegate = nil;
  self.fetchedResultsController = nil;
  self.searchFetchedRC.delegate = nil;
  self.searchFetchedRC = nil;
  [self fetchedResultsController];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:18:14+00:00Added an answer on May 28, 2026 at 2:18 am
    - (void)dealloc {
      //[self.mySearchDisplayController release];
      self.mySearchDisplayController.delegate = nil;
      self.mySearchDisplayController = nil;
      //[self.fetchedResultsController release];
      self.fetchedResultsController.delegate = nil;
      self.fetchedResultsController = nil;
      //[self.searchFetchedRC release];
      self.searchFetchedRC.delegate = nil;
      self.searchFetchedRC = nil;
      //[self.tableView release];
      [textView release];
      self.tableView.delegate = nil;
      self.tableView = nil;
      [super dealloc];
    }
    

    You are over-releasing your properties, as setting it to nil already release it for retained properties. I tried to remove extra releasing code by commenting them out, so please try to replace your dealloc with my code above and see.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.