I'm trying to convert a string to NSDate but I'm getting an error.
NSLog(@"JSON %@", responseObject);
NSArray *login = responseObject;
NSString *expires = [login valueForKey:@"expires"];
NSLog(@"%@", expires);
NSLog of responseObject (I used MMRecord 1.3 and AFNetworking 2)
<Login: 0x91dcdb0> (entity: Login; id: 0x91dcdf0 <x-coredata:///Login/t82A1AC69-501C-4C49-BAEE-C676FD655FDE2> ; data: {\n \"access_token\" = \"******************\";\n error = nil;\n \"error_description\" = nil;\n expires = \"Thu, 22 May 2014 02:30:21 GMT\";\n \"expires_in\" = 1209599;\n \"grant_type\" = nil;\n issued = \"Thu, 08 May 2014 02:30:21 GMT\";\n password = nil;\n \"token_type\" = ***;\n userName = \"su@email.in\";\n userid = nil;\n})
When I NSLog that string expires
I get something like this
(
"Thu, 22 May 2014 02:17:02 GMT"
)
If I do anything operation on that string, I'm getting this error
[__NSArrayI length]: unrecognized selector sent to instance 0x9754950
I think, for some reason, expires
is of type NSArray. Can You tell me what wrong with this? How can I change it to NSDate? I'm new to iOS. Thanks in Advance!