TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Could any iOS Developer Give me some pointers?

2 pointsby markcrazyhorseover 10 years ago
I&#x27;m quite new to iOS Development and wanna get stuck right in :) I&#x27;m just looking to find the best practice for this:<p>I know I can use CLLocationManager to get the users location but I want to create an app that does this:<p>User logs in &gt; app checks web server for online users in specified radius in miles&#x2F;feet of the current users phone &gt; displays users.<p>What is the best way to go around this? much appreciated for all your help.

2 comments

mtmailover 10 years ago
I think stackoverflow is better for this specific question.<p>Having said that most databases (on the backend) have spatial extension where you can run queries like &#x27;where inside(point,geometry)&#x27;. So you create a bounding box or circle around the user, then run a query. That&#x27;s faster than calculating distances between all users. The databases have special indices for geographic lookup. Both point and geometry probably need to be specified in WKT format. <a href="http://www.gaia-gis.it/spatialite-2.1/SpatiaLite-manual.html" rel="nofollow">http:&#x2F;&#x2F;www.gaia-gis.it&#x2F;spatialite-2.1&#x2F;SpatiaLite-manual.html</a> <a href="http://docs.mongodb.org/manual/applications/geospatial-indexes/" rel="nofollow">http:&#x2F;&#x2F;docs.mongodb.org&#x2F;manual&#x2F;applications&#x2F;geospatial-index...</a>
subv3rsionover 10 years ago
Assuming you have the coordinates for the each online user, iterate that collection, create a CLLocation object from the coordinate data, and check that object against CLLocation method distanceFromLocation with a radius value.<p><a href="https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/index.html#//apple_ref/occ/instm/CLLocation/distanceFromLocation" rel="nofollow">https:&#x2F;&#x2F;developer.apple.com&#x2F;library&#x2F;ios&#x2F;documentation&#x2F;CoreLo...</a>:
评论 #8856712 未加载
评论 #8856379 未加载