Skip to content →

message sectionOffset sent to freed object

Pardon the relatively technical post, but I want to document this problem somewhere in hopes that it saves someone the frustration it caused me.

I’ve been experimenting with iPhone development lately. For the most part, it’s been a fun learning process despite the quirks that Xcode, IB, and Obj-C throw at an MS developer. Objective-C is, at worst, a 20-year-old hack that follows few conventions established by most other OO languagues.

My most recent lesson has been adapting my project to use Core Data for persistence. Early on, I kept receiving the error “message sectionOffset sent to freed object” when trying to load a connected table.

I found the solution nowhere online, and the exception is not at all helpful. For me, the problem was that I was trying to access the FetchedResultsController before performFetch had been called. Adding performFetch to my viewDidLoad fixed the issue, and I was on my way. My iPhone app is on its way.

Published in tech

5 Comments

  1. Ladd

    Ladd

    Nick,

    UGH!!!!!!!!

    Thanks a bunch! Now I’m on my way again after several VERY frustrating hours!!!

    Ladd

  2. Awesome, Ladd. Glad I could help.

  3. yes, it did happen to me to. after seeing this post, I was back on track…

    thanks!

  4. Ryan

    Ryan

    How did you add the preform fetch to viewdidload(), sorry this question is coming from a noob.

  5. Ryan, I have the following code in my viewDidLoad:

    NSError *error;
    if (![self.fetchedResultsController performFetch:&error])
      NSLog(@"Fetch error: %@", [error domain]);
    

Leave a Reply

Your email address will not be published. Required fields are marked *