I’m trying to assign the value of an attribute of type Boolean. When I tried doing that I end up in this error
Job appears to have crashed: Segmentation fault: 11
Here is the code below:
NSMutableArray *emails = [[NSMutableArray alloc] init];
NSError *error = nil;
//This is your NSManagedObject subclass
SalesPerson * client = nil;
NSFetchRequest * request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"SalesPerson" inManagedObjectContext:self.managedObjectContext]];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name == %@", query];
[request setPredicate:predicate];
NSArray *results = [self.managedObjectContext executeFetchRequest:request error:&error];
client = [results objectAtIndex:0];
client.mailed = TRUE;
NSLog(@"client email %@",client.email);
[emails addObject:client.email];
I have three attributes name , email and mailed. When I try to change the attribute mailed of the entity it throws me the above mentioned error. Mailed is of the type boolean. Other attributes are strings which on update does change.
Not sure whether this is the solution you are looking for. Check your coredata model class and make sure
mailedis declared asNSNumberand notBOOL. So whenever you are storing or reading you need to convert from one to the other.