Please note, this blog entry is from a previous course. You might want to check out the current one.
When running on a real device, which region is set to something having not a “.” as comma symbol, the app crashes. Strangely it does not crash on the simulator.
One way to cope with this behavior is to force the number formatter to use the US locale all the time:
if let displayText = display.text { let numberFormatter = NSNumberFormatter() numberFormatter.locale = NSLocale(localeIdentifier: "en_US") if let displayNumber = numberFormatter.numberFromString(displayText) { return displayNumber.doubleValue } }
Continue reading “cs193p – Project #1 Assignment #1 Internationalization”