apinho
apinho

Reputation: 2285

iOS Push Notifications Localization

I would like to know what is the default behaviour of silent push notifications when the app is on foreground. Will it still display an alert view or not?

When localising the alert message :

"alert" : {
            "body" : "Start the game Jenna"
            "loc-key" : "start.game",
            "loc-args" : [ "Jenna"]
 }

Does the body message takes precedence over the loc-key? What if the loc-key does not exist on the app?

Upvotes: 3

Views: 6421

Answers (2)

Michael Teper
Michael Teper

Reputation: 4651

The docs imply that it's either/or: you should either set the body or the loc-key / loc-args properties.

Apple docs.

They might fall back to body if loc-key is not found, or they might never even look it up in Localizable.strings when body is present. Since docs don't define it, I would not count on the behavior one way or the other.

Upvotes: 4

hansg
hansg

Reputation: 51

Just tested setting both body_loc_key and body

If the client doesn't have body_loc_key in it's Localizable.strings it will show the body text otherwise it will show the localized string of body_loc_key

Which is just what I want and probably what you would expect.

Upvotes: 1

Related Questions