Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, this isn't a SQLite error, it's a standard, basic Objective-C error. You'd have the same problem even if you weren't using a SQLite-based Core Data store.</p> <p>Let's work backward from where it looks like the error is occurring, which is:</p> <pre><code>NSDictionary *attributes = [[obj entity] attributesByName]; </code></pre> <p>You're calling <code>entity</code> on <code>obj</code>. But where did <code>obj</code> come from? From here:</p> <pre><code>[Exercises enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { </code></pre> <p>OK, so <code>obj</code> came from <code>Exercises</code>. What is in <code>Exercises</code>?</p> <pre><code>NSArray* Exercises = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:dataPath] options:kNilOptions error:&amp;err]; </code></pre> <p><code>Exercises</code> is an array of things that <code>NSJSONSerialization</code> gave you. The <code>JSONObjectWithData:options:error:</code> method gives you Cocoa equivalents for the JSON content. <strong>It does not give you managed objects</strong>. In this case it looks like your JSON produced an array of <code>NSDictionary</code>.</p> <p>So what happened is:</p> <ol> <li>You used <code>NSJSONSerialization</code> and got an array of dictionaries</li> <li>You iterated over that array</li> <li>You attempted to call <code>entity</code> on the members of the array, only the array members are <code>NSDictionary</code> instances, and that class does not implement <code>entity</code>.</li> </ol> <p>Your code never creates any Core Data objects, anywhere. That's why you're not getting any Core Data objects. Your code is crashing because you're trying to call Core Data methods on objects that don't implement those methods.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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