問題描述
從 iOS 5 開始,有兩種通知樣式:橫幅和警報(舊"樣式).用戶可以在設置中為每個應用程序設置使用哪種樣式.但是,現在的默認設置似乎是通知以橫幅樣式顯示.
Starting with iOS 5, there are two notification styles: banner and alert (the "old" style). A user can set which style to use for each application in the settings. However, the default now seems to be that notifications are displayed banner style.
我正在使用本地通知來提醒現在"將要發生的事件.橫幅在它出現后不久就會消失(并且它不夠明顯以至于人們可以點擊它),因此對于這些通知,最好有警報樣式通知,因為這些通知會一直留在屏幕上,直到用戶決定采取行動(忽略或去到應用程序).
I'm using local notifications for reminders about events that will happen "now". A banner disappears shortly after it appeared (and it's not obvious enough that one can tap it), so for these notifications it would be desirable to have the alert style notifications as those stay on screen until the user decided on an action (ignore or go to app).
有沒有辦法通過代碼或例如 Info.plist
條目告訴 iOS 默認情況下應該使用警報樣式通知(只要用戶沒有配置其他東西)?
Is there a way either through code or for example Info.plist
entries to tell iOS that the alert style notifications should be used by default (as long as the user hasn't configured something else)?
更新:信息/文檔的缺失不足以讓我解決這個問題.我想要一個有權威的人(Apple 員工或類似 Erica Sadun 的人)發表的論壇/博客帖子之類的東西,說這是不可能的,或者如果有可能,那么我想要解決方案.要求用戶更改設置" 之類的解決方法也不夠好.
Update: The absence of information/documentation is not enough for me to have this settled. I want either something like a forum/blog post from someone with authority (Apple employee or someone along the lines of Erica Sadun) saying it's not possible, or if it is possible then I want the solution. A workaround like "ask the user to change the setting" isn't good enough either.
推薦答案
我想補充一點,因為我已經打開了一個 TSI,不知何故我問了這個問題并得到了答復.來自奎因愛斯基摩人!":
I would like to add something, since I've opened a TSI and somehow I asked about this and have been answered. From Quinn "The Eskimo!":
這取決于您的意思.您可以根據您設置 UILocalNotification 屬性(如 alertBody、soundName 等)的方式來控制通知的顯示方式.但是,如果您詢問進入的方式這些屬性被解釋(用戶可以在設置>通知中自定義的東西),這些是用戶偏好,不通過任何 API 公開."
"This depends on you mean. You have some control over how the notification appears based on how you set the UILocalNotification properties (things like alertBody, soundName, and so on). However, if you're asking about the way in which those properties are interpreted (the things the user can customise in Settings > Notifications), those are user preferences and not exposed via any API."
這篇關于為應用程序設置默認的 iOS 本地通知樣式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!