NSMutableArray で何らかの検索を行っていますが、SIGABRT が頻繁に発生します。私はobjective-cが初めてなので、ここで重要なことを見逃したかどうかわかりません...
-(IBAction)findButtonPushed:(id)sender
{
Data *stuff = [Data getInstance];
[stuff.results removeAllObjects];
NSMutableArray *tempResults = [[NSMutableArray alloc] init];
for (Company *company in stuff.companies) {
if ([company.Description rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.Name rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.Url rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.FirstName rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.LastName rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.Keywords rangeOfString:[sbWhat text] options:NSCaseInsensitiveSearch].location != NSNotFound) {
[tempResults addObject:company];
}
}
if (![[sbWhere text] isEqualToString:@""]) {
for (Company *company in tempResults) {
if ([company.Street rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.City rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.ZipCode rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.State rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.AddressPt1 rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.AddressPt2 rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound
|| [company.Country rangeOfString:[sbWhere text] options:NSCaseInsensitiveSearch].location != NSNotFound) {
[stuff.results addObject:company];
}
}
}
else{
stuff.results = tempResults;
}
[self performSegueWithIdentifier:@"ShowResults" sender:self];
}
ところで、sbWhere と sbUISearchBars とは
これら 2 つの if ステートメントで SIGABRT を取得しています。json文字列を解析して得た会社。