我不断收到错误“由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'+ [MainViewController minimumFormInContext:]:无法识别的选择器发送到类”来自这行代码:NSLog(@“访问特定的矿井实体”);
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Mine" inManagedObjectContext:managedObjectContext];
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
NSError *error = nil;
[request setEntity:entity];
NSPredicate *predicate;
NSPredicate *metalFilter;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *region = [defaults stringForKey:@"mineArray"];
if([region isEqualToString:@"Butte & Plumas"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@)",@"Butte",@"Plumas"];
}
else if([region isEqualToString:@"Sutter, Yuba, & Sierra"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@) OR (county Contains %@)",@"Sutter",@"Yuba",@"Sierra"];
}
else if([region isEqualToString:@"Nevada & Placer"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@)",@"Nevada",@"Placer"];
}
else if([region isEqualToString:@"Sacramento & El Dorado"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@)",@"Sacramento",@"El Dorado"];
}
else if([region isEqualToString:@"San Joaquin, Amador, & Calaveras"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@) OR (county Contains%@)",@"San Joaquin",@"Amador", @"Calaveras"];
}
else if([region isEqualToString:@"Tuolumne & Stanislaus"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@)",@"Tuolumne",@"Stanislaus"];
}
else if([region isEqualToString:@"Merced, Mariposa, & Madera"])
{
predicate = [NSPredicate predicateWithFormat:@"(county Contains %@) OR (county Contains %@) OR (county Contains %@)",@"Merced",@"Mariposa",@"Madera"];
}
[request setPredicate:predicate];
mArray = [[NSMutableArray alloc] init];
mArray = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
使用调试器,我将错误范围缩小为:
mArray = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy];
我该如何解决?