不断跟踪iOS上的用户位置 [英] Constantly tracking user location on iOS
问题描述
我需要不断监控用户的位置,以便在他接近有趣的事情时通知他。这是实现这个目标的正确方法吗?
I need to constantly monitor the position of an user to notify him when he gets near something interesting. Which is the correct way to achieve this?
我无法在后台运行定时器(定期更新用户在服务器上的位置),我也是阅读订阅重要的位置更改可能会让我收到位置更新,即使应用程序没有运行,但我不能让它发生。
我在正确的道路上吗?还有其他选择吗?
I have not been able to keep a timer running in the background (to periodically update user's position on the server), I also read that subscribing to significant location changes could have make me receive location updates even when the app is not running, but i can't get it happen. Am I on the right path? Are there any other options?
编辑 -
有一个我应该暴露的必备条件,这可能让我放松对真正问题的关注:
EDIT - There is a requisite that i should have exposed and that is probably making me loose the focus on the real problem:
- 用户周围有趣的东西没有固定的位置,所以在发送推送之前我必须确保用户目前在那个位置(当然我可以假设n分钟)。
- Interesting "stuff" around the user has not a fixed location, so before sending a push I have to be sure that the user is currently in that location (of course i can assume it for n minutes).
推荐答案
免责声明:我为Cintric工作
Disclaimer: I work for Cintric
我们在Cintric遇到了类似的问题,实际上是为了这个目的而制作了一个工具。它将在应用程序退出后跟踪背景中的位置,仅使用1%的电池!
We had a similar problem at Cintric and actually made a tool just for this purpose. It will track the location in the background even after the app has been quit, using only 1% battery too!
您可以下载.framework文件,将其拖入您的使用一行代码进行项目初始化:
[CintricFind initWithApiKey:@YOUR_API_KEY_HEREandSecret:@YOUR_SECRET_HERE];
You can download the .framework file, drag it into your project and initialize with one line of code:
[CintricFind initWithApiKey:@"YOUR_API_KEY_HERE" andSecret:@"YOUR_SECRET_HERE"];
您可以免费获得API密钥。
You can get an API key for free.
这里有文档: https://www.cintric.com/docs/ios
还有一篇博文解释此处: http://www.blog.cintric.com/?p=121
And there is a blog post explaining further here: http://www.blog.cintric.com/?p=121
这篇关于不断跟踪iOS上的用户位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!