分析我的 ios 项目时出现此错误
The left operand of '==' is a garbage value
这就是代码发生位置的样子。此方法用于对从数据库返回给我的数组进行排序。
- (NSMutableArray *)startSortingTheArray:(NSMutableArray *)unsortedArray
{
[unsortedArray sortUsingComparator:^ NSComparisonResult(SearchResultItem *d1, SearchResultItem *d2) {
//initalize comparison
NSComparisonResult result;
NSInteger manufacturerID1 = d1.manufacturerID;
NSInteger manufacturerID2 = d2.manufacturerID;
if (manufacturerID1 > manufacturerID2)
return NSOrderedAscending;
if (manufacturerID1 < manufacturerID2)
return NSOrderedDescending;
if (manufacturerID1 == manufacturerID2) {
NSString *model1 = d1.model;
NSString *model2 = d2.model;
result = [model1 localizedCompare:model2];
}
if (result == NSOrderedSame) {
//..