Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
762 views
in Technique[技术] by (71.8m points)

ios - How can I send an Apple Push Notification with multiple lines i.e. with a ' ' character?

I would like to know how to send an apple push notification message with multiple lines. Using ' ' doesn't seem to work.

Something like:

First line

Second Line

Right now it seems to just ignore the message altogether.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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
 and argument: %@";

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...