Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here are a few recommendations:</p> <ul> <li><p>The code you posted to get the <code>.mom(d)</code> file is not exactly the recommended way. Use <code>mergedModelFromBundles</code> instead, as in</p> <pre><code>self.managedObjectContent= [NSManagedObjectModel mergedModelFromBundles:nil]; </code></pre> <p>It takes care of getting the path, choosing/merging the correct <code>mom</code> or <code>momd</code>, and initializing of the MOC all by one step. You <strong>should</strong> use this. But note that you need to clean the build process once in a while, as discussed in <a href="https://stackoverflow.com/questions/2282105/using-mergedmodelfrombundles-and-versioning-coredata">this SO question/answer</a>.</p></li> <li><p>This shows that, although crawling through StackOverflow is often good, that's not the best approach when you deal with a big framework like CoreData. </p> <p>Honestly, take a day and read <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html%23//apple_ref/doc/uid/TP30001200-SW1" rel="nofollow noreferrer">the documentation</a> from the start to the end. You might want to google bits of code and to start coding immediately, but reading through the documentation definitely saves the development time considerably in the long run. </p> <p>Also, Marcus Zarra's CoreData book (see <a href="http://pragprog.com/titles/mzcd/core-data" rel="nofollow noreferrer">here</a>) helped me a lot. It might look expensive, but it was totally worth while.</p></li> <li><p>On a different topic, I don't think it a good strategy to put the pre-cooked sqlite file into the simulator's directory (inside <code>~/Library/Application Support/iPhone Simulator/</code>) even for development purpose... because it doesn't work on the real device. If you need to do so, put the sqlite file as a resource of the app, and copy it at the launch time to either <code>Documents</code> or <code>Caches</code>, and use that afterwards.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload