开发者

how to find location using wifi in iphone

In my app, I am trying to figure out the location of my app user using WiFi (not GPS because my main area is inside the buildings), can any one please tell me how can I get 开发者_StackOverflow中文版user location using hotspot of WiFi.

Any basic guide or example is good .

Thanks in advance.

egards


Use Core Location. The Core Location framework hides the actual device capability from you (more or less) and (depending on the options you set) give you a best estimate for latitude and longitude. I've used the exact same app on an iPhone and iPod touch and have gotten pretty good results with the touch. It won't be as accurate, but it's good enough for most applications.

Check out the Core Location documentation and the "LocateMe" sample code from the developer site: https://developer.apple.com/library/ios/#samplecode/LocateMe/Introduction/Intro.html


Unless you mean to figure out the location of your user in a specific building with known Wi-Fi spots, you'll have to resort to using a IP address geolocation database. There are services, such as that provided by MaxMind, that have a database which you subscribe to for updates. The database maps IP addresses to locations.

This will only get you approximations, so your best bet is to use GPS primarily but IP address as a backup.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜