开发者

iPhone: repeating background task

开发者 https://www.devze.com 2023-03-07 07:27 出处:网络
I am looking for alternatives to push notifications. I开发者_运维技巧 would like my app to periodically connect to the server and check for new messages in some kind of background task. If new message

I am looking for alternatives to push notifications. I开发者_运维技巧 would like my app to periodically connect to the server and check for new messages in some kind of background task. If new messages are found I can use Local Notifications to inform the user, but as far as I know Apple doesn't like apps running in the background.

Is there some way to schedule code to run at some set interval, even when the app is in the background, or shutdown completely? (for those of you who know Android, I'm looking for something like BroadcastReciever and Service) If I could do that it would solve all my problems.

TIA!

PS: we are developing for iOS 4+


There isn't a good mechanism in iOS to do this unfortunately. Your only two options are to use the location services (significantLocationChange) to get notified in the background when the device moved, or pretend to be a VOIP app in which case you can request processing time at a specified interval. The second method won't get your app approved for the App Store though.

0

精彩评论

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