I want to set the second element of the loc-args array from the push notification payload into the loc-key translation when my app is open, e.g. in the didReceiveRemoteNotification
method.
Example of the loc-args in the payload is an array of two elements:
[
"Apple",
"1 Infinite Loop Cupertino, CA 95014"
]
The translation for the loc-key is:
Goto address: %2$@
If the push message arrives when the app is in the background it works fine. The message is showed as:
Goto address: 1 Infinite Loop Cupertino, CA 95014
But if the app is in the foreground I have to handle it by myself in the didReceiveRemoteNotification
method for example with:
let message = String(format: "Goto address: %2$@",
arguments: ["Apple", "1 Infinite Loop Cupertino, CA 95014"])
But this gives the result: Goto address: Apple
instead of Goto address: 1 Infinite Loop Cupertino, CA 95014
Can anyone tell me how to fix this?
Extra info:
If I change the loc-key to: Goto address: %2$@ - %1$@
the text will be: Goto address: 1 Infinite Loop Cupertino, CA 95014 - Apple
Thanks.