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 6771623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:27:14+00:00 2026-05-26T15:27:14+00:00

I am developing my first iPhone app for a couple of months and now

  • 0

I am developing my first iPhone app for a couple of months and now I got stuck on a memory error “message sent to deallocated instance”. I have written down all my observations (from the debugger) but can’t find the reason. I will really appreciate any help.

SITUATION:

I have created pick_ListBrowseController, a subclass of UITableViewController.
It is called to pick an item from a scrolling list. The objects presented come from a CareData database.
I useNSFetchedResultsController.

In the implementation of pick_ListBrowseController, there is a typical method returning a fetched results controller:

- (NSFetchedResultsController *) fetchedResultsController {

  // If the fetched results controller already exists, return it:
     if (fetchedResultsController != nil) { return fetchedResultsController;}   

  (…) // constructing fetchRequest object with entity and sort descriptors

  [NSFetchedResultsController deleteCacheWithName:@"pick_List"];

  // Create fetched request controller:
  NSFetchedResultsController *aFetchedResultsController = 
  [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest 
            managedObjectContext:self.managedObjectContext 
            sectionNameKeyPath:nil cacheName:@"pick_List"]; 
  // Set the fetched results controller's delegate to self;
  //  it will send controllerDidChangeContent:
       [aFetchedResultsController setDelegate: self]; 
  // Assign this new fetched results controller to the property:
   [self setFetchedResultsController: aFetchedResultsController];
  // Return fetched request controller:
  return fetchedResultsController;
}   

BUG SCENARIO A:

STEP 1) I call my pick_ListBrowseController, select an item and navigate back. The view disappears.
In the debugger, I can see that the pick_ListBrowseController object had memory address 0x729b950

STEP 2) I call pick_ListBrowseController once again. It is now another instance, with memory address 0x755a4e0

STEP 3) When I try to pick an item, I get error message:

[pick_ListBrowseController controllerDidChangeContent:]: message sent
to deallocated instance 0x729b950.

The address is from STEP 1) ! For some reason, the framework code (which is not accessible for me) sends controllerDidChangeContent: to the already deallocated object from STEP 1), not to the object from STEP 2), as it should.

BUG SCENERIO B:

Even worse, it happens even when in STEP 1) I call a different controller object , also a subclass of UITableViewController. Steps 2) and 3) remain the same. The same bug occurs and in the debugger I can see that even now controllerDidChangeContent: is sent to the object from STEP 1). Hence it is sent not only to the wrong (and deallocated) object, it is even sent to an object from a different class!

QUESTIONS:

1) What may be the reason? How to fix it?

2) My app is really big. Is it possible that it became too big causing the memory problems described above? If yes, what can I do to get things right?

Currently, I use Xcode Version 4.2 build 4C199 and I use Automated Reference Counting (ARC) – I went through the refactor process “convert to Objective-C ARC”.

Any help will be highly appreciated.

  • 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-26T15:27:15+00:00Added an answer on May 26, 2026 at 3:27 pm

    It is likely that your FRC is not getting released when your VC is dealloc ed. If it is hanging around and has your VC as a reference to the delegate then you have a dangling pointer. Double check that you are cleaning up the FRC.

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

Sidebar

Related Questions

I'm developing my first iPhone app. One day, I renamed some files including xib
I've been developing my first iPhone app part-time and would like to start using
I'm developing a first iPhone app for iOS 4.x/5.0 and have some confusions on
I'm developing my first iPhone app and I would greatly appreciate you guy's input
i'm developing an iPhone app for the first time. I know that username and
We are developing our first iPhone game, and all is going OK for now.
Looking at developing an iphone app for the first time upon Windows. I have
I am developing an App for iPhone (my first app) and I want to
I'm developing my first iPhone app, and while implementing user preferences, I have a
I'm developing my first iPhone app, which is a navigation based one. I want

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.