如何处理远程推送通知有效内容中的loc-key

时间:2019-01-15 16:46:28

标签: ios swift push-notification apple-push-notifications

我已经在AppDelegate.swift中的didReceiveRemoteNotification方法中实现了对远程推送通知的处理,除了以下格式的有效负载外,它均有效。

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

我想格式化并在通知警报上显示loc-args的内容。我想从loc-args中提取“ Jenna”和“ This is Message”,并在警报的正文和警报标题中如下显示:

珍娜的新消息

这是消息

我一直在阅读tut,但是我无法弄清楚要完成它到底要做什么。我想保持简单。有什么帮助吗? Tx

1 个答案:

答案 0 :(得分:-1)

解决方案是Localizable.strings