I'm an IOS newbie but am trudging forward as best as I can.
I searched this site and google but found no answer to my problem, or even any parallel.
I am using a method declared in the documentation (I actually borrowed this line from a website on obtaining the timezone offset in hours):
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] initWithDateFormat:@"zzz" allowNaturalLanguage:NO];
But the compiler error message says:
No visible @interface for 'NSDateFormatter' declares the selector 'initWithDateFormat:allowNaturalLanguage:'
When I try the autocomplete, it does not suggest this particular init method, only init and initWithCoder.
Am I missing some required import? I thought this was a part of the Foundation.h.
Any help would be greatly appreciated.
Thanks.
Jason
The method NSDateFormatter initWithDateFormat:allowNaturalLanguage: is not part of iOS. That method is only available for the Mac. For iOS do:
NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"zzz"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With