I have a problem reading "expires_in" values from OAuthAccessToken jsons. The value comes as a Unix Epoch int from the service.
The code line at OAuthAccessToken.swift
let expiresAt = (json["expires_in"] as? NSTimeInterval).flatMap(toNSDate)
If json["expires_in"] = 1475233174
Sets expiresAt value to: 2063-06-30 20:59:08 +0000 (this NSdate converted to UNIX epoch is 1475233174*2)
But if I change the converter to
let expiresAt = NSDate(timeIntervalSince1970: (json["expires_in"] as? NSTimeInterval)!)
The expiresAt value is correct
What is the difference between .flatMap and NSDate() converters?
Should the json["expires_in"] be in another format?
I have a problem reading "expires_in" values from OAuthAccessToken jsons. The value comes as a Unix Epoch int from the service.
The code line at OAuthAccessToken.swift
let expiresAt = (json["expires_in"] as? NSTimeInterval).flatMap(toNSDate)
If json["expires_in"] = 1475233174 Sets expiresAt value to: 2063-06-30 20:59:08 +0000 (this NSdate converted to UNIX epoch is 1475233174*2)But if I change the converter to
let expiresAt = NSDate(timeIntervalSince1970: (json["expires_in"] as? NSTimeInterval)!)
The expiresAt value is correctWhat is the difference between .flatMap and NSDate() converters? Should the json["expires_in"] be in another format?
Thanks