开发者

iphone - apns alert option (no view option) possible?

开发者 https://www.devze.com 2023-03-27 12:07 出处:网络
In the official Apple document it says alert string or dictionary If this property is included, iOS displays a standard alert. You may specify a string a开发者_运维技巧s the value of alert or a di

In the official Apple document it says

alert

string or dictionary

If this property is included, iOS displays a standard alert. You may specify a string a开发者_运维技巧s the value of alert or a dictionary as its value. If you specify a string, it becomes the message text of an alert with two buttons: Close and View. If the user taps View, the application is launched. Alternatively, you can specify a dictionary as the value of alert. See Table 3-2 for descriptions of the keys of this dictionary.

But I wonder if there's any option that I can add to the code to make the push only show "close" button.

Ex of what I have now: @"{\"aps\":{\"alert\":\"Update OS\"},\"acme1\":\"updateos\",\"acme2\":42}";


I think you can use a dictionary. Have a look at Table 3-2 on the same page, for the key action-loc-key, it says:

If a string is specified, displays an alert with two buttons, whose behavior is described in Table 3-1. However, iOS uses the string as a key to get a localized string in the current localization to use for the right button’s title instead of “View”. If the value is null, the system displays an alert with a single OK button that simply dismisses the alert when tapped. See “Localized Formatted Strings” for more information.

The single OK button is perhaps what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消