这是我的代码:
for (NSManagedObject *object in array) {
if ([[object valueForKey:@"DueDate"] isLessThan:[NSDate date]]) {
count++;
NSLog(@"Looped");
NSString *test = [[NSString alloc] initWithFormat:@"%@", [object valueForKey:@"DueDate"]];
NSLog(@"%@", test);
}
}
NSLog(@"%i", count);
NSDockTile *aTitle = [[NSApplication sharedApplication] dockTile];
[aTitle setBadgeLabel:[NSString stringWithFormat:@"%i", count]];
出于某种原因,此代码在应该为 2 时将 8 添加到停靠图标