在iOS4的后台发布位置更新 [英] Posting location updates in background from iOS4

查看:117
本文介绍了在iOS4的后台发布位置更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在iOS4的后台向我的服务器发送位置更新吗?我想让用户更改位置,并使用Web服务调用将其发布到服务器。这里的主要问题是,当应用程序处于后台时,是否可以调用Web服务或http-post?

Can i send location updates to my server in background from iOS4?. I want to get users location changes and post it to a server using a web-service call. Main question here is, is it possible to call a web-service or http-post while app is in background?

推荐答案

绝对可以,您可能想当我问同样的问题时,请回顾这个早期的主题 - @RedBlueThing提供关键信息的信用。

Absolutely, and you may want to review this earlier thread when I asked the same question - credit due to @RedBlueThing for providing the key information.

我已经写了这个作为一个例子也在我们的博客上。这项工作的关键是 beginBackgroundTaskWithExpirationHandler:没有它你将无法获得可靠的结果,因为它可能会在某些时候工作,但不会在其他时间工作。

I've written this up as an example on our blog as well. The key to this working is beginBackgroundTaskWithExpirationHandler: without that you won't get reliable results as it will perhaps work some of the time, but not others.

这篇关于在iOS4的后台发布位置更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆