Xcode警告:当NSLog使用它时,“未使用的变量”

时间:2013-10-11 09:54:23

标签: ios xcode warnings

我不明白为什么当我选择“个人资料”时,我会收到几个“未使用的变量”警告。

喜欢这段代码:

+ (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]]);
    }
}

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

Screenshot

为什么探查者会抱怨?

0 个答案:

没有答案