How to support title and subtitle in iOS push notifications?

We have added support for sending title and subtitle along with your message in an iOS push notification. To enable it for your account, please ensure the following:

  • MoEngage iOS SDK supports this change from SDK version 2.4 and above, hence ensure that your app is (or app users are) not on MoEngage iOS SDK version below 2.4. If this is the case, please update MoEngage iOS SDK to the latest version.
  • If you are parsing the push notification payload and accessing the "alert" key from the payload, ensure that the parsing logic supports both the variants of push notification payload as shown below:
    • Without title and subtitle:
      Code
      ...
      "aps" : { "alert" : "Push Message", "mutable-content" : 1, "badge" : 1 }
      ...
    • With title and subtitle:
      Code
      ...
      "aps" : { "alert" : {
          "title": "New Push Title",
          "subtitle" : "New Subtitle - from iOS10",
      "body":"Push Message"
      }, "mutable-content" : 1, "badge" : 1 }
      ...

    After the above points are ensured contact moengage support to enable this feature for your account.

     

     

Was this article helpful?
10 out of 19 found this helpful

How can we improve this article?