首页 > 解决方案 > How to handle loc-key in remote Push Notification payload

问题描述

I've implemented handling of remote push notifications in didReceiveRemoteNotification method in AppDelegate.swift and it works except for payloads of following format.

{
"aps" : {
    "alert" : {
        "loc-key" : "GAME_PLAY_REQUEST_FORMAT",
        "loc-args" : [ "Jenna", "This is Message"]
    },
    "sound" : "chime.aiff"
},
"acme" : "foo"
}

I want to format and show the content of loc-args on the notification alert. I want to extract "Jenna" and "This is Message" from loc-args and display on alert as below in body and title of alert:

New Message from Jenna

This is message

I've been reading tuts but I can't figure out what exactly I've to do to get it done. I want to keep it simple. Any help? Tx

标签: iosswiftpush-notificationapple-push-notifications

解决方案


Solution was Localizable.strings


推荐阅读