Czytałem inne posty na temat tej awarii, które mają coś wspólnego z predykatem, który zwrócił zero, ale nie jestem w stanie tego rozgryźć z moją aplikacją. Czy ktoś mógłby mi z tym pomóc?NSInvalidArgumentException ', powód: "Nieprawidłowy predykat: zero RHS, potrzebuję pomocy w ustaleniu tego na zewnątrz
static NSString *const KJMWorkoutCategorySectionKeyPath = @"workoutCategory";
- (NSFetchedResultsController *)fetchedResultsControllerWithSearchString:(NSString *)searchString {
NSManagedObjectContext *sharedContext; // my NSManagedObjectContext instance...
NSFetchRequest *request = [NSFetchRequest new];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Workouts"
inManagedObjectContext:sharedContext];
request.entity = entity;
request.predicate = [NSPredicate predicateWithFormat:@"(workoutName CONTAINS[cd] %@)", searchString];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:KJMWorkoutCategorySectionKeyPath ascending:YES];
request.sortDescriptors = @[sortDescriptor];
NSFetchedResultsController *fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request
managedObjectContext:sharedContext
sectionNameKeyPath:KJMWorkoutCategorySectionKeyPath
cacheName:nil];
fetchedResultsController.delegate = self;
NSError *error = nil;
if (![fetchedResultsController performFetch:&error]) {
NSLog(@"Unresolved error %@, %@", error, error.userInfo);
abort();
}
return fetchedResultsController;
}
Awaria następuje na linii 'predicateWithFormat' lub' set " Linia orzecznicza? –
ulega awarii dokładnie w następującej linii: 'if (! [AFetchedResultsController performFetch: & error])' – kevnm67