TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

2 点作者 markcrazyhorse超过 10 年前
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 条评论

mtmail超过 10 年前
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>
subv3rsion超过 10 年前
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 未加载