0

I Googled around and I can't find many discussions on this. I want to develop an iOS program that would use access a REST service, and I want to get notified of updates so I am thinking of long polling. Does RestKit deal with this?

Another questions is what if I want to run in the background? It seems like the proper way to do is to set up an Push Notification Service and notify the user to open the app to receive the latest message?

huggie
  • 17,587
  • 27
  • 82
  • 139

1 Answers1

0

Doing a job in background is only possible with special APIs like Music and Location, so you won't even be able to do queries if the user is not using your app.

Instead, you should do all the heavy work on a web service, and setup an APNS server to notify the user when something happens. That way, it won't drain all the battery of your users and use technology in place exactly for that purpose.

There's also a lot of service to send out push notifications, if you don't want all the heavy setup. Take a look at http://parse.com or http://urbanairship.com/.

allaire
  • 5,995
  • 3
  • 41
  • 56
  • How about service like PubNub which claims to use long poll? Do they use long poll when app is in the foreground and somehow resolve to APNS in the background? If not, can I do something like that? – huggie Dec 14 '12 at 14:25
  • See right here: https://help.pubnub.com/entries/21738438-can-my-ios-app-receive-messages-while-inactive – allaire Dec 14 '12 at 14:47
  • OK thanks. That still leaves open the question of whether RESTKit has some support for long poll while the app is in the foreground. – huggie Dec 14 '12 at 15:04
  • 1
    If you use RestKit 0.2.x, take a look at AFNetworking for that, since that's what RK use for the HTTP layer now. I don't have any snippets of code about how to do that, cause I never done that before. You'll have to google it :) – allaire Dec 14 '12 at 15:08