warning: 'NSDate' may not respond to '+currDate'
Above is a warning message when I compile the following code:
-(IBAction)getDate:(id)sender {
currDate = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[ dateFormatter setDateFormat:@"yyyy-MM-dd"];
strCurrDate = [dateFormatter stringFromDate:[NSDate currDate]];
displayDate.text = strCurrDate;
[dateFormatter release];
}
I'm just trying to get the current date and display it in a label called displayDate
.
Using the debugger I can see that the date is never converted to a string and stored into strCurrDate
.
The warning message is on the line where I try to use stringFromDate
Can anyone see why this isn't working properly? Any help would be greatly appreciated.
I also currDate is my header file:
NSDate *currDate;