Hi,
I was playing with NSDateFormater to parse a string I am getting from a rest api, in a playground.
And it is working fine. Here the exact lines I have in my playground:
import UIKit
let lTs = String("Mon, 07 Dec 2015 3:58 pm EST")
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "EEE, dd MMM yyyy h:mm a zzz"
let lDate = dateFormatter.dateFromString(lTs)
print("\(lDate!)")
The result is "2015-12-07 20:58:00 +0000\n"
By if I copy-paste this code in my project, it crashes at the print line because the lDate variable is nil!!!
How is it possible?
This part of code is in a callback from an api call (using Alamofire)
I have absolutely no clue on why this is happening. Is there a way to see the reason why NSDateFormater is failing?
Thanks