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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:39:31+00:00 2026-05-27T23:39:31+00:00

I have started playing around with CoreData and taking a new project with CoreData

  • 0

I have started playing around with CoreData and taking a new project with CoreData and building those foundations into my own project. I have reached a stage where I have more or less identically duplicated the fresh project, however I am getting an error.

This line, controller.managedObjectContext = self.managedObjectContext; is causing me problems. When I comment it out, the app simply launches with a blank UITableView, however if I include the line, it causes this error:

Universal[24718:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewController setManagedObjectContext:]: unrecognized selector sent to instance 0x1521a0'
*** First throw call stack:
(0x344558bf 0x346a51e5 0x34458acb 0x34457945 0x343b2680 0x2413 0x378367eb 0x378303bd 0x377fe921 0x377fe3bf 0x377fdd2d 0x30c30df3 0x34429553 0x344294f5 0x34428343 0x343ab4dd 0x343ab3a5 0x3782f457 0x3782c743 0x2331 0x22c8)
terminate called throwing an exception

I you need anymore code to look at, I can provide it and I hope you have an idea of whats happening. I can’t see anything which would cause this, I am not getting any errors, but I get this log as that line causes the entire app to crash.

The line resides in the didFinishLaunchingWithOptions method of the app delegate, just like in a fresh core data project.

As requested, the header file for the table view controller:

#import <UIKit/UIKit.h>

#import <CoreData/CoreData.h>

@interface myTableViewController : UITableViewController <NSFetchedResultsControllerDelegate>

@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
@property (strong, nonatomic) NSManagedObjectContext *managedObjectContext;

@end
  • 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-27T23:39:32+00:00Added an answer on May 27, 2026 at 11:39 pm

    The reason why you are getting the error is in your AppDelegate.m

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
        UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController;
        MasterViewController *controller = (MasterViewController *)navigationController.topViewController;
        controller.managedObjectContext = self.managedObjectContext;
        return YES;
    }
    

    When using the default CoreData template the managed object context is assigned to the topViewController which no longer is MasterViewController as you’ve inserted a different view as your starting point. Thus the unrecognized selector sent to instance.

    You have two options:

    1) Remove the code that assigns the managed object context and, in the view that needs it get it like this

     [[[UIApplication sharedApplication] delegate] mainManagedObjectContext];
    

    2) Keep the code (correct the class name), add declaration for managedObjectContext, and pass your NSManagedObjectContext object throughout all your app between all your UIViewControllers

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

Sidebar

Related Questions

I'm new to cmake and have just started playing around with it. My problem
I have started playing around with db4o but quite soon I have run into
I have started playing around with Apache camel recently. So being the experimental type
I've started playing around with transitions and have come up against quite a big
I have a basic GWT Maven project going. I added SmartGWT and started playing
I have started playing around with Berkeley DB. This one is really interesting, but
I have recently started playing around with sites and created a basic page. <apex:page
Possible Duplicate: Is JavaScript's Math broken? I have just started playing around with Javascript
I have just started programming in C++ and I was playing around with templates.
I am playing around with MVC and have started setting up an existing site

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.