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

  • Home
  • SEARCH
  • 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 8102071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:08:36+00:00 2026-06-05T23:08:36+00:00

I try to explain my problem. I have a first view in which I

  • 0

I try to explain my problem.

I have a first view in which I have some buttons. Pressing a button the app open a tableview. I have those files in my project:

  • AppDelegate.h/m
  • viewcontroller.h/m to control the first view
  • Entity1TableViewController.h/m to control the tableview opened by that
    button in 1st view
  • an .xcdatamodel

so, until I’m in the tableview all is right. I putted this

 NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
 NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
 NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"Ditloide" inManagedObjectContext:context]; 

and when I tab on the button I receive the error:

+entityForName: could not locate an NSManagedObjectModel for entity name 'Ditloide' in a second view

I read other posts in which I found something like this:

MainViewController *controller = (MainViewController *)self.window.rootViewController;
controller.managedObjectContext = self.managedObjectContext;

to put in the rootcontroller. but in my case, where can I put this? I have to create a new controller? if yes, I cant insert the

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

method.

So, how can I solve the problem?

  • 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-06-05T23:08:38+00:00Added an answer on June 5, 2026 at 11:08 pm

    I’m not pretty sure I understand your question.

    The error is due to the fact you didn’t set up the MOC correctly. See insertNewObjectForEntityForName: for further details.

    The question is: did you set up the core data stack correctly? Could you share some code?

    Then, about the code you have seen, it has the goal to inject the context wherever it is needed. For example, suppose you have a controller, called YourController, that needs the context. You can create a property in YourController like the following:

    //.h
    @property (nonatomic, retain) NSManagedObjectContext* context; // or strong if you ARC
    
    //.m
    @synthesize context;
    

    Then, from a different element, for example the app delegate (if you have set up the core data stack there), you could just create YourController and inject it.

    YourController* yourCtr = // alloc-init
    yourCtr.context = [self managedObjectContext];
    

    Finally, what do you mean with if yes, I cant insert the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method?

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

Sidebar

Related Questions

I have a problem and I will try to explain the issue: I have
I'll try to explain the problem in the math language. Assume I have a
I'll try to explain my problem. I have this linkbutton with a CssClass: <asp:LinkButton
I have a little problem with elFinder. I'll try to explain the best I
I'm currently having a problem with events in Javascript. I'll first try to explain
I have a problem with js menu code. first let me explain what I
Having some problem figuring out how to do this. Will try and explain what
I'll try to explain my problem as clear as possible :). I am using
I'm going to try to explain the problem. I am getting a string containing
All right, I'll try to explain my problem as clearly as I can. I

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.