iphone应用程序可以在后台唤醒重要的位置更改吗?

Rog*_*ger 17 iphone networking location background ios4

我正在开发一个应用程序来监控后台的重要位置变化.我一直在阅读关于ios4和应用程序生命周期的所有答案(好吧,我想全部!)但是我无法弄清楚当应用程序在后台唤醒时我是否可以进行任何网络访问由于重大的位置变化.

该应用程序当前通过TCP套接字进行网络访问.应用程序暂停时,套接字将关闭.

我是否可以重新连接套接字,接收一些数据,发送新位置,然后在接收位置更改事件后仍然在后台关闭套接字?在办公室里静止时很难测试!我们可以假设网络活动完成时间不到10秒.还假设该应用程序未注册为voip应用程序(可能/应该是?...)

有任何想法吗?

Red*_*ing 11

Yep. You can do your network processing based on significant change events.

When you get woken up into the background state on significant change (from terminated or suspended state), you can make your http request. If you find your app is being terminated before you finish your HTTP request, you can ask for additional background processing time via the beginBackgroundTaskWithExpirationHandler: method on UIApplication.

I spent a fair bit of time on short train trips to test this out. :)