Swift Specialised Crash on UICollectionView cellForItemAtIndexPath
I finally got my hands on an iphone which was crashing. Turns out there are a couple of problems:
The crash reports of iOS, Crashlytics and iTunes are completely useless. The actual place where the code was crashing was never marked by them but was marked by xcode when it crashed in debug mode. So don't believe on the reports generated by crashlytics or itunes.
The actual problem was that I get a time from the server in the 'HH:mm:ss' format, which I was converting into 'hh:mm a' format since I wanted the AM, PM for my UI. Now the great thing done by iOS is that if the user has his phone's time settings in the 24 Hour format, there would be no AM/PM returned and the app would crash because I was not checking the String returned is nil. To solve the above problem I had to set the locale to:
df.locale = NSLocale(localeIdentifier: "en_US_POSIX")
The problem is finally solved. The main learning is that don't depend on the crashlytics or Itunes reports