Tag: nsfetchrequest

-: unrecognized selector

I’ve got some Core Data code that follows Apple’s sample code precisely (the Fetching Attribute Values that Satisfy a Given Function example). I’m using it to get the max value of a field, so I can then increment it when I insert the next object of that entity type. I couldn’t get the code to […]

NSInvalidArgumentException', reason: 'Unknown predicate type for predicate: BLOCKPREDICATE(0x70ad750)' Error

I have a core data database and I am trying to create a fetch request using a block predicate, but I get an Unknown Predicate error: NOTE: employeeToHouse is a property of type House that was created for me when I subclassed NSManagedObject NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@”Place”]; request.predicate = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) […]

Swift Core Data – Group doesn't Work

I am working on a simple iOS Swift app and can’t find any solution for a small problem with core data. I have to group some data which i fetch out of core data, but it doesn’t work. This is my fetchRequest: <NSFetchRequest: 0x7f82fbe105e0> (entity: Sets; predicate: ((null)); sortDescriptors: (( “(sort, ascending, compare:)” )); type: […]

Showing duplicate cells in UITableView via NSFetchedResultsController?

I am querying Core Data to find the “OLDEST” and “HEAVIEST” amongst a group of people. With a larger dataset this usually works (as the chance of a duplicate match is less), but with a small dataset where the OLDEST person may also be the HEAVIEST I am having problems. [John, 77, 160] [Pete, 56, […]

Retrieve last row/object in Core Data entity as a string

I need to develop a simple login system for my Questionnaire app. I have two Entity‘s – one for saving Questionnaire data called NGLS which stores client details, survey answers, etc, and another called Admin for the user. The user can type in their username which gets saved to the Admin entity. They can then […]

fetchRequestFromTemplateWithName variables

I’m using Xcode 4.2.1 and trying to use a variable. I understand in xcode 4 you need to set the variable with $variable. I have in Xcode for my fetch request the variable as $currDate and my code as NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; [dateFormatter setDateFormat:@”YYYYMMdd”]; NSDate *currDate = [NSDate date]; NSString *currDateString = [dateFormatter […]

NSFetchRequest returning nothing

Can anyone spot why this isn’t returning any ManagedObjects? I’m trying to add to the ATNSManagedObject+EasyFetching class the following, but the fetch result returns nothing. If I fetch these outside of the EasyFetch class I have 100+ objects so I know it isn’t CoreData being empty. + (void)deleteAllObjectsInContext; { NSManagedObjectContext *context = [NSManagedObjectContext defaultContext]; NSEntityDescription […]

UITableView not updating DataSource after change to NSFetchedResultsController

I have an UITableView populated by a NSFetchedResultsController. The initial fetch works fine. I can add, remove, modify, etc with zero problems.. But I want to add user-defined sorting to the table. I am doing this by changing the NSFetchedResultsController to use a different sortDescriptor set, and a different sectionNameKeyPath. Here is the code where […]

Can I set transient properties to fetch?

I want to create NSFetchRequest and set properties to fetch like this: request.propertiesToFetch = @[@”a”, @”b”, @”c”]; where a and b are stored in Core Data database, and c is transient. executeFetchRequest: fires an error Invalid keypath c passed to setPropertiesToFetch:. But if I uncheck transient-checkbox for property c everything will work fine. So is […]

executeFetchRequest:error: freezes app

I don’t know what it is but it happens when is fetching elements, well that’s what I asume because the app just freezes, I pause the debugging and the debugger stops at a return [__context executeFetchRequest:request error:&error]; Any help about this will be very appreciated.