如何使用多行发送Apple推送通知,即带有'\ n'字符? [英] How can I send an Apple Push Notification with multiple lines i.e. with a '\n' character?
本文介绍了如何使用多行发送Apple推送通知,即带有'\ n'字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何发送包含多行的Apple推送通知消息。使用'\ n'似乎不起作用。
I would like to know how to send an apple push notification message with multiple lines. Using '\n' doesn't seem to work.
类似于:
第一行
First line
第二行
现在看来似乎完全忽略该消息。
Right now it seems to just ignore the message altogether.
推荐答案
添加可本地化的字符串文件并在那里添加字符串。例如,你可以有类似的东西:
Add a localizable strings file and add your string there. For example, you could have something like:
"Push_String" = "My push string with a line break\n and argument: %@";
现在在通知有效负载中,使用loc-key和loc-args属性,例如:
Now in your notification payload, use the loc-key and loc-args properties, for example:
"loc-key":"Push_String","loc-args":["My argument!"]
现在您的通知应该有换行符。
Now you should have a line break in your notification.
这篇关于如何使用多行发送Apple推送通知,即带有'\ n'字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文