Arsalan Haider
Arsalan Haider

Reputation: 559

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 ?

Upvotes: 0

Views: 363

Answers (2)

Nandakumar R
Nandakumar R

Reputation: 1414

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.

Upvotes: 1

Alex Coplan
Alex Coplan

Reputation: 13371

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.

Upvotes: 1

Related Questions