目前我使用了以下代码,但它只会返回两位数代码
if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String {
print("Code => \(countryCode)") //FR
}
Run Code Online (Sandbox Code Playgroud)
但我需要三位数代码(FRA),请有人建议我获取 ISO
639-2 代码
我还检查了Apple文档,但我不知道如何获取确切的代码
谢谢。