作者uranusjr (←這人是超級笨蛋)
看板MacDev
標題Re: [問題] 偵測notification center 顯示是否開啟
時間Fri Jun 27 14:38:01 2014
※ 引述《pigcat1315 (還是朋友?)》之銘言:
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.59.236.139
※ 文章網址: http://webptt.com/m.aspx?n=bbs/MacDev/M.1403842301.A.6CE.html
1F:→ uranusjr:無法 06/27 13:19
2F:→ pigcat1315:提示樣式 選無 有辦法偵測嗎? 06/27 14:21
[UIApplication sharedApplication].enabledRemoteNotificationTypes
typedef enum : NSUInteger {
UIRemoteNotificationTypeNone = 0,
UIRemoteNotificationTypeBadge = 1 << 0,
UIRemoteNotificationTypeSound = 1 << 1,
UIRemoteNotificationTypeAlert = 1 << 2,
UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3
} UIRemoteNotificationType;
文件
http://d.pr/Dh8R
要注意這是把 disply style, badge 和 sound 合併處理(先不管 newsstand)
所以提示樣式選擇無只會造成 UIRemoteNotificationTypeAlert 這個 bit 被設成 0
而不見得會回傳 UIRemoteNotificationTypeNone
所以你要用 if (types & UIRemoteNotificationTypeAlert) 這樣判斷
然後我要道德勸說一下
通知關閉是使用者的決定, 沒有人會沒事把原本打開的東西特地進去關掉
這種暗示使用者做錯事情的訊息感覺不太尊重對方
請永遠假設使用者很懶惰, 但不要把他們當笨蛋
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.94.57
※ 文章網址: http://webptt.com/m.aspx?n=bbs/MacDev/M.1403851089.A.6C4.html
※ 編輯: uranusjr (140.112.94.57), 06/27/2014 14:43:59
3F:推 pigcat1315:主要是怕使用者安裝第一次安裝~選否收不到 06/27 14:47
4F:推 pigcat1315:謝謝回答~原來我忽略這篇 06/27 14:58
6F:→ mraaa:你講到重點了,第一次選否就否啦!使用者需要,他自己會再開 06/27 22:11
7F:→ mraaa:! 06/27 22:11
8F:→ mraaa:每次你都要提示會很煩!就已經選否了=.= 06/27 22:12
9F:推 drag:我遇到的是使用者第一次安裝選否之後,回頭報bug 07/02 15:34
10F:→ drag:說push notification沒有動作,後來才發現自己關掉了...=,= 07/02 15:35