0

This line is working perfect at ios 9 but when I try it on ios 8 its crashing and says

fatal error: unexpectedly found nil while unwrapping an Optional value

so what should I do for this. This is my code.

self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.blackColor(),NSFontAttributeName: UIFont(name: ".SFUIDisplay-Bold", size: 18)!]
Murat Kaya
  • 1,281
  • 3
  • 28
  • 52
  • It's not. I know what should I do when my data or object returns nil. But its different code its working in ios 9 but its not working ios 8. I'm trying to understand why its returning nil on ios 8 – Murat Kaya Jun 04 '16 at 22:03
  • Can you please do some debugging and figure out exactly which call is returning `nil`? – NobodyNada Jun 04 '16 at 22:05
  • 1
    Duplicate. `UIFont(name: ".SFUIDisplay-Bold", size: 18)!` UIFont returns nil, you're force unwrapping: crash. – Eric Aya Jun 04 '16 at 22:08

0 Answers0