For the BNRLogger program, the lastTimeString method is as follows:
static NSDateFormatter *dateFormatter = nil;
dateFormatter = [[NSDateFormatter alloc] init];
return [dateFormatter stringFromDate:self.lastTime];
When the code in the first part of this chapter is run, the dateFormatter pointer is created and, I assume because it is set to nil, the if (!dateFormatter) statement evaluates to true, and the code within the if statement is executed. This method gets called every two seconds. From the second call of this method, onward, the if (!dateFormatter) statement evaluates to false, and the code within the if statement does not get executed. But, why is that? Immediately before the if statement, the method declares the dateFormatter pointer to be nil again. Shouldn’t the if statement once again evaluate as true?