I asked few days ago about how to get a list of countries in Swift, and you solved the first part of it (here: Swift - Get list of countries), but I am not able to get the final countries list because it gives an error:
var countries: NSMutableArray = NSMutableArray()
countries = NSMutableArray(capacity: (NSLocale.ISOCountryCodes().count))
for countryCode : AnyObject in NSLocale.ISOCountryCodes() {
let dictionary : NSDictionary = NSDictionary(object:countryCode, forKey:NSLocaleCountryCode)
let identifier : NSString = NSLocale.localeIdentifierFromComponents(dictionary)
// next line - fatal error: Can't unwrap Optional.None
let country : NSString =
NSLocale.currentLocale().displayNameForKey(NSLocaleIdentifier, value: identifier)
countries.addObject(country)
}
println(countries)
What does the "fatal error: Can't unwrap Optional.None" error mean? I've been trying and searching about it but I haven't find the solution yet :/
Million thanks :)