我想在應用程序打開時將loc-args數組的第二個元素從推送通知載荷設置爲loc-key翻譯。在didReceiveRemoteNotification
方法中。在有效載荷中的LOC-args來如何在iOS中將loc-args與loc-key字符串合併推送通知
實施例是兩個元素的數組:
[
"Apple",
"1 Infinite Loop Cupertino, CA 95014"
]
翻譯爲LOC-關鍵是:
Goto address: %[email protected]
如果推送消息到達時當應用程序在後臺工作正常。該消息顯示爲:
Goto address: 1 Infinite Loop Cupertino, CA 95014
但是,如果應用程序是在前臺我有我自己的didReceiveRemoteNotification
方法來處理它。比如用:
let message = String(format: "Goto address: %[email protected]",
arguments: ["Apple", "1 Infinite Loop Cupertino, CA 95014"])
但這給出結果:Goto address: Apple
而不是Goto address: 1 Infinite Loop Cupertino, CA 95014
誰能告訴我如何解決這個問題?
額外的信息:
如果我改變LOC-關鍵:Goto address: %[email protected] - %[email protected]
文本將是:Goto address: 1 Infinite Loop Cupertino, CA 95014 - Apple
感謝。
'字符串叉子(格式:...)'不允許*省略*位置參數。請參閱http://stackoverflow.com/questions/1063843/is-there-a-way-to-specify-argument-position-index-in-nsstring-stringwithformat中的註釋。 –