In iOS, no app has unlimited background working permissions except the VOIP apps, the navigation apps or the music apps(unless your app is one interfacing with some external hardwares via bluetooth). They can only work for a particular amount of time, after which, they enter into the suspended state.
Now as far as your comment asks about the IM apps, they use Apple Push Notification Services to notify the user of any important event and thus they handle that data at any time irrespective of the suspension time.
For eg., Facebook lets you know of any incoming message via push notification. When you open the app from that, your appDelegate's applicationDidFinishLaunchingWithOptions:
method gets called which has the argument containing the information your push notification intended it to have. You can have a look at the push notification services documentations on Apple website here. Also there is a good tutorial of it on Ray Wenderlich.