Ios – Apple Push Notification Service – change title of notification message

apple-push-notificationsiosjsonpush-notification

I have APNS messages working well. However I'd like to change the title of the messages that are sent. Currently the title is always the name of my app. I see that notifications for the native iOS 'Mail' app have the 'From' address as the title of the message and also have the email subject showing in bold as a sub-heading to the notification. I'd like to reproduce this for my app's notifications but can't see how to do this. The JSON payload just seems to have a key for "alert" with no mention of a 'title' key. Is it possible to achieve what I want?

Best Answer

I just stumbled over this old question and just wanted to add, that specifying a title and body for the notification is now possible (since iOS 8, I think).

Your push payload needs to look like this:

{
  "aps": {
    "alert": {
        "title": "New Message from Boss",
        "body": "Can you complete the new feature until tomorrow, please?!"
    }
  }
}

You find the detailed specs in Apple's Local and Remove Notification Programming Guide.