According to the official Apple documentation, APNS (Apple Push Notification Service) stores only the last notification if the device is offline.
Apple Push Notification Service includes a default Quality of Service
(QoS) component that performs a store-and-forward function. If APNs
attempts to deliver a notification but the device is offline, the QoS
stores the notification. It retains only one notification per
application on a device: the last notification received from a
provider for that application. When the offline device later
reconnects, the QoS forwards the stored notification to the device.
The QoS retains a notification for a limited period before deleting
it.
Then how do apps like whatsapp send messages from multiple users when the device comes online? Those messages would have been received as separate notification if device was online.
It seems like there was an update to this issue on iOS 8 that will allow your app to wake up in the background due to push even if your user manually killed it. Check this out: Wake your app in the background using PushKit in iOS8.
This means that you can send notifications to your app and once it's re-connected, it will be woken up by the operating system and will be able to communicate with your server. Then, you can implement the logic to send it all of the push messages that were missed while the device was offline.
I have to admit that I have yet to try it out myself, but it sounds like this might be the solution to the issue you're describing.
Since every notification you send while the device is offline effectively overwrites the existing one, you have two ways to go about this:
Include all messages that the device does not know about yet in every notification (so you replace a notification that contains message A with one that contains both message A and B). You may run into a maximum size limit at some point.
Do not include the actual messages in your notifications at all. When the application gets the notification, it can ask the server for new messages.