开发者

Location Finding in iPhone SDk

开发者 https://www.devze.com 2023-03-28 14:33 出处:网络
Can we get the a rough location of iPhone without using GPS开发者_开发百科. Something region in the iPhone settings will also be helpful.?

Can we get the a rough location of iPhone without using GPS开发者_开发百科. Something region in the iPhone settings will also be helpful.? Any Idea ?


Free web apis are available to detect the location using the IP address.

http://www.ipaddressapi.com/

http://ipinfodb.com/ip_location_api.php

By using these API you can determine the nearest city.


When you use the core location framework, it will look for location by using any method of three: GPS, cell tower triangulation, and wi-fi positioning. This means that all iOS devices can get their location.

There is no reason for you not to use this.

However, you did say 'something region in the iphone settings'. This code can get the country name:

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

For more info on NSLocale, see Apple's locales programming guide.

0

精彩评论

暂无评论...
验证码 换一张
取 消