iOS 后台获取地理位置并且上传-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

iOS 后台获取地理位置并且上传

a123456678 2016-07-20 10:18:26 1897

按照文档上说的,有两种地理位置获取办法。一种是用standard方式,一种是Significant-Change,如有要在后台执行,那么按照文档说:

Significant-Change: If you leave this service running and your app is subsequently suspended or terminated, the service automatically wakes up your app when new location data arrives.

If your app needs location updates delivered whether the app is in the foreground or background, there are multiple options for doing so. The preferred option is to use the significant location change service to wake your app at appropriate times to handle new events. However, if your app needs to use the standard location service, you can declare your app as needing background location services.

也就是说我用significant-change的方式可以一直在后台获取地理位置信息,或是标记为needing background location services后用standard方式在后台获取地理位置信息。

但是我测试了很多次,一般是跑10-20分钟就不再获取地理位置信息了。。是否有人做过这一块,求指导,谢谢!

定位技术 iOS开发
分享到
取消 提交回答
全部回答(1)
  • a123456678
    2019-07-17 19:58:43
     if ([CLLocationManager significantLocationChangeMonitoringAvailable])
        {
            [[[OTGPSHelper instance] localtionManager] startMonitoringSignificantLocationChanges];
        }
    0 0
IoT
使用钉钉扫一扫加入圈子
+ 订阅

物联网软硬件开发者一站式基地

推荐文章
相似问题