Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you didn't have any <strike>crush</strike> crash (and not only in this case), first I would replace the string: </p> <pre><code>[managedObjectContext save: &amp;error]; </code></pre> <p>with something like:</p> <pre><code>// Save the managed object context. NSError *error = nil; if (![self.managedObjectContext save:&amp;error]) { NSLog(@"Failed to save object to managed object context: %@, %@", error, [error userInfo]); } </code></pre> <p>Perhaps (and I think most likely), NSlog in this case will give you some info. In any case, man, saving is a quite dangerous operation and you shouldn't leave it without additional, at least small, check.</p> <p>Good luck!</p> <p><strong>EDIT:</strong><br> Could you post how <em>actually</em> you make a fetching of the objects from the database. As far as I understand, you perform it here:</p> <pre><code>tracks = [self fetchTracks]; </code></pre> <p>But what is there?<br> Also, I find a bit confusing the frase:</p> <blockquote> <p>Im using a NSFetchRequest not a fetchedResults controller.</p> </blockquote> <p>You create an object of NSFetchRequest in order to <em>describe</em>, what you want to retrieve (fetch) from the database. You do it properly, but I don't see in the code where you <em>actually</em> use this request then...<br> For the purpose of retrieving <em>NSFetchedResultsController</em> is being used. You set it up smth. like:</p> <pre><code>NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; </code></pre> <p>And then, to perform the actual fetch, you do smth. like:</p> <pre><code>if (![self.fetchedResultsController performFetch:&amp;error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); } </code></pre> <p>(after this you can get all the objects from fetchedResultsController) </p> <p><strong>OR</strong>, if you don't want to use controller, directly fetch to array:</p> <pre><code>NSError *error = nil; NSArray *array = [managedObjectContext executeFetchRequest:request error:&amp;error]; if (array == nil) { // Deal with error... } </code></pre>
    singulars
    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. This table or related slice is empty.
    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