I am trying to define the equivalent of DateTime.MaxValue (C#) but in Objective C.
I don’t want to keep creating NSDates every time I use it so I wish I had it as const.
The problem, the compiler returns “Initializer element is not constant”
Here is the code
static NSDate* DateTimeMinValue = [NSDateFormatter dateFromString:@”00:00:00.0000000, January 01, 1984″];
I also tried
NSDate* const DateTimeMinValue = [NSDateFormatter dateFromString:@”00:00:00.0000000, January 01, 1984″];
Also, what would the difference between the static and const be?
While this is not the exact answer to your question it still might help you.
Did you ever read or hear about
they return
They come in quite handy when you have to compare dates to well a distant Date.