title: Could not locate an NSManagedObjectModel for entity name - Universal App
body: <p>I have a strange error in my app, which says:</p>
  
  <p><em>*</em> Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Book'</p>
  
  <p>I know, there are hundrets of "Could not locate an NSManagedObjectModel for entity name" topis here and on the web, but the strange thing is, it's a universal app and the iphone app always works fine, only the ipad app is crashing on startup.</p>
  
  <p>In the main AppDelegate, there is some code in two methodes and in the iphone / ipad AppDelegate I'm calling this code in applicationdidFinishLaunchingWithOptions like this:</p>
  
  <pre><code>    if ([self modelExists] == NO) {
      [self buildModel];
  }
  </code></pre>
  
  <p>So it's the same way I call the code, but the ipad version crashes and the iphone version does not.</p>
  
  <p>The only different is that the iPhone version uses a TabBarContoller (set up in IB) and the iPad version uses a single viewController (also set up in IB).</p>
  
  <p>It happens on both, simulator and device.</p>
  
  <p>I have no idea what to do. Hope you can understand what I mean ...
  Thx a lot
  Sebastian</p>
  
  <p>EDIT:
  I found out, when I run the iPhone Version, the code in the main AppDelegate is called as it should be, but when I run the iPad Version NONE code of the main appDelegate is called at all, so there is no managedObject created and that's the reason for the error. But why is no code run in the main AppDelegate ? Thx</p>
  
  <p>EDIT2:
  This is the code in my main AppDelegate now:</p>
  
  <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
  if ([self modelExists] == NO) { // Checks if the model is allready filled up or not. (Uses  CoreData stuff of course)
  // iPhone Version is fine here. iPad Version crashes.
      [self buildModel];
  }    
  
  [self buildInterface]; // Called in the iPhone or iPad AppDelegate to make the window visible etc.
  return YES;
  }
  </code></pre>
  
  <p>So didFinishLaunchingWithOptions is called in the iphone and in the ipad version. The iPad version just doesn't run the coredata stuff anyway, whereas the iphone version does run the coredata stuff as it should. Any idea what could be wrong? THX!</p>