-5
struct APIVersionCheck
{
   static let nsObject: AnyObject? = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as AnyObject
   static let date = UserDefaults.standard.value(forKey: "VersionDateParameter")
   static let CheckdeviceToken = ""
   static let checkAppVersion = nsObject as! String
   static let CheckDeviceType = 1
   static let CheckCustomerId = "1055"
   static let CheckDate = Validator.sharedValidation().checkBlankString(APIVersionCheck.date as! String) == false ? "2016-08-03 11:20:53.957" : (APIVersionCheck.date as! String)
}

In last line of this struct CheckDate is getting nil value and therefore it prevents other codes also to get it run by crashing app. Will anybody contribute their so precious opinion to fix this issue ?

Hardik Chavda
  • 101
  • 10

1 Answers1

0

Please manage some conditions in the date variable. May be defaults send you a nil value if it is nil. And check the case if it nil then put another date in the date variable. Don't direct pass the userDefaults value in date variable

Gourav Joshi
  • 2,419
  • 2
  • 27
  • 45