Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在没有互联网连接的情况下获取用户国家和GPS.
GPS
我尝试使用运营商信息获取用户的国家/地区
(CTTelephonyNetworkInfo *info = [CTTelephonyNetworkInfo new]; CTCarrier *carrier = info.subscriberCellularProvider;),
但这提供了运营商的原始位置,而不是活跃国家。
例如,如果用户有AT&Tsim 卡并且他在法国,我会得到 US
AT&T
有什么建议么?
您可以尝试通过检查设备上选择的时区来获取用户的时区城市,然后使用设备上的本地数据库将其转换为国家/地区。试试这个
NSTimeZone *timeZone = [NSTimeZone localTimeZone]; // or try [NSTimeZone systemTimeZone]; NSString *timeZoneName = [timeZone name];