简体   繁体   中英

Posting location updates in background from iOS4

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?

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.

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.

Yes. You can basically do anything you want in the background callbacks.

I'd like to add that you should make sure you are aware of the possible impact on battery life, as the antennas may have to be turned on to perform your requests. Perhaps you could store the locations in core data, and post it to the server when the app resumes.

But there's no technical reasons to not do it, and afaik it will pass review too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM