Determine iPhone user's country

前端 未结 5 1355
天涯浪人
天涯浪人 2020-12-05 02:41

I need to determine at startup what country a user is in, for an iPhone application. Presumably I will have to turn on location services and do some sort of reverse geocodin

5条回答
  •  情歌与酒
    2020-12-05 03:24

    NSLocale *locale = [NSLocale currentLocale];
    NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];
    
    NSString *countryName = [locale displayNameForKey: NSLocaleCountryCode
                             value: countryCode];
    

提交回复
热议问题