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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:50:31+00:00 2026-05-28T19:50:31+00:00

Just creating a new iPhone application with CoreData. My application builds without any warnings

  • 0

Just creating a new iPhone application with CoreData. My application builds without any warnings or errors and has my .xcdatamodeld in it as well which has no errors or warnings.

For some reason my managedObjectModel won’t initialise and I can’t work out why.

- (NSManagedObjectModel *)managedObjectModel {
 if (__managedObjectModel) {
     return __managedObjectModel;
}

 NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"BAK" withExtension:@"momd"];
 __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];    
 return __managedObjectModel;
}

The modelURL resolves correctly and points to my compiled data model but the managedObjectModel stays at nil after its alloc line. There is no output into the console either. What can cause this or what am I missing?

The __managedObjectModel is declared as follows:

.h
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
.m
@synthesize managedObjectModel = __managedObjectModel;

Thanks for your help.

  • 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-28T19:50:31+00:00Added an answer on May 28, 2026 at 7:50 pm

    My bet is you changed the model somehow, most likely the name (“BAK” to something else or something else to “BAK”).

    That initialization of the NSManagedObjectModel is really simple. If it has been initialized and exists, return it, otherwise initialize the ManagedObjectModel using the name you provided (“BAK”).

    The only other explanation is that somehow, someway, the Core Data model didn’t get initialized in the main bundle location, but somewhere else.

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

Sidebar

Related Questions

I have been developing iPhone application and just started adding CoreData for persistence. However
I am new to winforms. I am just creating a score card application. There
I am new to iphone development.I am creating a map application.Now i am facing
I am new to the iPhone. I'm creating an application. For that I want
I just finished creating my first major application in C#/Silverlight. In the end the
I am just simply creating a web application. I wanted to insert a line
I am just getting started creating an AJAX application using server side push. I
I'm new to iPhone dev. My app is dynamically creating buttons, following from my
I've just seen a video of the new Squarespace iPhone app and they appear
I'm creating a base class that has an isDirty flag. It is set any

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.