3

我不明白为什么当我选择“配置文件”时会收到几个“未使用的变量”警告。

就像这个代码片段:

+ (void) printReadingsForDevice:(NSMutableArray*)device
{
    NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
    [dateFormatter1 setDateFormat:@"HH:mm dd.MM.yyyy."];
    [dateFormatter1 setTimeZone:[NSTimeZone systemTimeZone]];
    
    for (NSDictionary *reading in device)
    {
        NSNumber *value = [reading objectForKey:keyValue];
        NSNumber *batteryState = [reading objectForKey:keyBatteryState];
        NSNumber *wifiConnectionTime = [reading objectForKey:keyWiFiConnectionTime];
        NSNumber *timestamp = [reading objectForKey:keyTimestamp];
        
        NSLog(@"value: %6.2f, batteryState: %3d, wifiConnectionTime: %5.1f, timestamp: %@, date: %@", [value floatValue], [batteryState integerValue], [wifiConnectionTime floatValue], timestamp, [dateFormatter1 stringFromDate:[NSDate dateWithTimeIntervalSince1970:[timestamp doubleValue] / 1000.0f]]);
    }
}

这是打印一些值的简单实用方法。

截屏

为什么探查器抱怨?

4

0 回答 0