Re: [問題] UILocalNotification 經Icon進入APP
※ 引述《itisjoe ( Good Day)》之銘言:
目前遇到的問題是
設定一個UILocalNotification後
當我不在這個APP裡面 也就是在外面APP列表 或是其他APP的時候
時間到了 他出現提醒
我不是從banner或是通知中心進入 而是直接按APP Icon進入
這時候這個Notification就不會被觸發及我設定觸發後的動作
但這時我先退出APP 再經由通知中心進入 就仍然會觸發該次的Notification
請問我在哪邊缺少了程式 導致經由APP Icon進入時 不會觸發Notification
我看到這篇文章 http://tinyurl.com/lu6x5r9
原址 http://stackoverflow.com/questions/
16469721/detect-unacknowledged-uilocalnotifications
所以我在 - (void)applicationDidBecomeActive:(UIApplication *)application 中
用 [[UIApplication sharedApplication] scheduledLocalNotifications] 找
用fireDate跟目前時間比對來找
但該次Notification已經不在裡面了 所以我也沒辦法找到
希望有做過類似東西的前輩可以給點指教
謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.193.201.234
※ 文章網址: http://www.ptt.cc/bbs/MacDev/M.1398322360.A.BC1.html
→
04/24 15:11,
04/24 15:11
→
04/24 15:12,
04/24 15:12
→
04/24 17:03,
04/24 17:03
→
04/24 23:23,
04/24 23:23
→
04/24 23:23,
04/24 23:23
→
04/24 23:24,
04/24 23:24
→
04/24 23:24,
04/24 23:24
根據 Apple 的 document:
"Scheduling, Registering, and Handling Notifications"
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW4
縮址:http://goo.gl/ZUqbkt
在 "Handling Local and Remote Notifications" 這一個段落有提到:
If the application icon is tapped on a device running iOS,
the application calls the same method,
but furnishes no information about the notification.
也就是使用者如果直接點 app 而不是點 notification 的話,
就沒辦法透過 launchOptions 拿到 notification 裡面的資料。
比較可行的方式應該如同 howdiun 所說。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.224.218.98
※ 文章網址: http://www.ptt.cc/bbs/MacDev/M.1398659795.A.72F.html
討論串 (同標題文章)