开发者

Location Finding in iPhone SDk

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜