fatal error: unexpectedly found nil while unwrapping an Optional value - Stanford Calculator
- 阅读更多 关于 fatal error: unexpectedly found nil while unwrapping an Optional value - Stanford Calculator
问题 I'm watching the Stanford Swift lecturers on ItunesU and have some trouble in understanding. The lecturer is typecasting a String to a Double at one point. He did it as follows: return NSNumberFormatter().numberFromString(display.text!)!.doubleValue display.text is a UILabel Anyhow, when I'm doing it like this my app crashes and I get the following error: fatal error: unexpectedly found nil while unwrapping an Optional value When I typecast the String like this: (display.text! as NSString)