Possible Duplicate:
NSDate initWithString
I wrote the following line of code:
[[NSDate alloc] initWithString:@"2013-03-24 10:45:32 +0200"];
When I try to compile I obtain the following error message:
ARC Semantic Issue:
No visible @interface for ‘NSDate’ declares the selector ‘initWithString:’
In project there is following include:
#import <Foundation/Foundation.h>
To be sure that class is included, I tried following line which is compiled without issues:
[[NSDate alloc] init];
What is wrong with my code?
XCode version 4.6.
Base SDK in project iOS 6.1.
initWithString function is not present in NSDate class for iOS Platforms, since you’ll need to first specify a date formatter using NSDateFormatter which converts textual representations of dates and times into NSDate objects. Use something like this :