开发者

How much time is an iOS app given when unsuspended or relaunched by a background service?

开发者 https://www.devze.com 2023-02-19 19:09 出处:网络
I have a location-based iOS 4 app that relies on significant location change monitoring while in the background. Apple\'s docs state:

I have a location-based iOS 4 app that relies on significant location change monitoring while in the background. Apple's docs state:

At wake-up time, your application is put into the background and given a small amount of time to process the location data. Because your application is in the background, it should do minimal work and avoid any tasks (such as q开发者_运维技巧uerying the network) that might prevent it from returning before the allocated time expires.

Does anyone know how long "a small amount of time is?" Specifically, I'm wondering if I have enough time to call startUpdatingLocation on a location manager in order to get a more accurate fix than what might be provided by the initial location event. (My background location events almost always report their horizontalAccuracy as 1000m.)

If Apple's "small amount of time" would be insufficient for that purpose, am I allowed to call beginBackgroundTaskWithExpirationHandler: from a backgrounded application in order to request more time? I know that usually gives you an additional 600s, which is more than adequate.


Do you absolutely need to find a more accurate fix during application re-launch, or can you do this heavy lifting after your app has been moved into the foreground, and show a "Loading..." type screen while the work happens? That would eliminate any concerns regarding timeouts.

0

精彩评论

暂无评论...
验证码 换一张
取 消