Find current country from iPhone device

前端 未结 9 1026
醉话见心
醉话见心 2020-12-04 08:38

I have to get the current country in the iPhone settings. Can anyone tell me how to get the current country in iPhone application.

I have to use the current country

9条回答
  •  我在风中等你
    2020-12-04 09:22

    Swift 3.0 latest working code is

    if let countryCode = (Locale.current as NSLocale).object(forKey: .countryCode) as? String {
        print(countryCode)
    }
    

提交回复
热议问题