我的应用程序支持4种语言和推送通知.当我向APNS发送推送通知时,我正在发送loc_key&loc-args.现在我需要在loc-args数组中发送本地化字符串,以便在应用程序收到推送通知时我可以在iOS应用程序端翻译它们.
但是当我发送本地化字符串时loc-args,它不是在通知中心显示已翻译的字符串,而是显示本地化的密钥.
我的字符串文件包含以下2条消息:
"WINNER_ALERT"= "Congratulations! %@ won the match & became %@ player";
"ROLE_PROFESSIONAL_LOCALIZED_KEY" = "professional"
Run Code Online (Sandbox Code Playgroud)
服务器发送有效负载
{
aps = {
alert = {
"loc-args" = (
"John",
"ROLE_PROFESSIONAL_LOCALIZED_KEY"
);
"loc-key" = "WINNER_ALERT";
};
badge = 1;
sound = default;
};
}
Run Code Online (Sandbox Code Playgroud)
当我发送上述有效负载然后在iOS通知中心,消息看起来像
Congratulations! John won the match & became ROLE_PROFESSIONAL_LOCALIZED_KEY player
Run Code Online (Sandbox Code Playgroud)
代替
Congratulations! JOHN won the match & became professional player
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我是否可以发送本地化的字符串loc-args?如果是的话,我的有效载荷有什么问题?
提前致谢
apple-push-notifications localizable.strings nslocalizedstring ios7