Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data: predicate is nil after instantiation
    primarykey
    data
    text
    <p>i have an iOS program with a simple Core Data schema: <img src="https://i.stack.imgur.com/on0H8.png" alt="Credata schema"></p> <p>and into a method i like to get the first and last point so i use this code for the last:</p> <pre><code>NSFetchRequest * lastPointFetch = [[NSFetchRequest alloc] init]; [lastPointFetch setEntity:[NSEntityDescription entityForName:@"PointsForTrack" inManagedObjectContext:appDelegate.managedObjectContext]]; NSPredicate * pred = [NSPredicate predicateWithFormat:@"ALL Track == %@", ((Track*)self.detailItem)]; [lastPointFetch setPredicate:pred]; [lastPointFetch setFetchLimit:(NSUInteger)1]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"timestamp" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [lastPointFetch setSortDescriptors:sortDescriptors]; NSArray *fetchResults = [appDelegate.managedObjectContext executeFetchRequest:lastPointFetch error:&amp;error]; if ([fetchResults count]&gt;0){ PointsForTrack *result = [fetchResults objectAtIndex:0]; NSLog(@"Point in track: %@", [dateFormat stringFromDate:result.timeStamp]); } </code></pre> <p>but this is the error that i god form framework:</p> <pre><code>2012-08-17 17:00:59.992 TrackMe[16799:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)' </code></pre> <p>*** First throw call stack: (0x376ef6c3 0x3996897f 0x3582558f 0x358252b5 0x35824ecd 0x35824647 0x35824111 0x35823529 0x35821e23 0x3d56d 0x3cf63 0x3d0d5 0x391258d5 0x39131d75 0x39131a81 0x39120163 0x3911fe03 0x39180abd 0x39203529 0x371e4aaf 0x376c49ff 0x376c46b1 0x376c3321 0x3763639d 0x37636229 0x35feb31b 0x391128f9 0x3a661 0x39ad0b20) libc++abi.dylib: terminate called throwing an exception</p> <p>any idea why this happen?</p> <p>thank in advanced</p> <p>UPDATE: i have printed the description of NSPRedicate and log all:</p> <pre><code>2012-08-17 20:59:39.081 TrackMe[8126:c07] NSPredicate ALL track == &lt;Track: 0x778f6b0&gt; (entity: Track; id: 0x778e0d0 &lt;x-coredata://58DE6A89-8060-4D63-90DD-C31A09F53C79/Track/p1&gt; ; data: { creationDate = "2012-08-17 18:56:23 +0000"; inAcquisition = nil; name = "New Track"; points = "&lt;relationship fault: 0x77953f0 'points'&gt;"; </code></pre> <p>}) 2012-08-17 21:00:04.679 TrackMe[8126:c07] <strong>* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate (null)' *</strong> First throw call stack: (0x1b41552 0x1477e7e 0x118c8f9 0x118c312 0x118c0e0 0x118beb5 0x118b697 0x118b184 0x118a2fd 0x1188259 0x6a19 0x61e0 0x6414 0x1a2c2c 0x1a2f5b 0x1b0a20 0x1b8a0d 0x1b92fb 0x1b98f3 0x1b94e8 0x513643 0x505379 0x5053f4 0x16f019 0x16f2bd 0xb6fef3 0x1b00956 0x1b003e6 0x1ae8042 0x1ae7504 0x1ae73db 0x1a9b823 0x1a9b6a8 0xc018c 0x2a4d 0x2975) libc++abi.dylib: terminate called throwing an exception</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. 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