→ howdiun:既然是local那就在發送時存一些資料到database 04/24 15:11
→ howdiun:開啟app時去讀取是否有發送就可以了 04/24 15:12
→ itisjoe:謝謝 我用這樣的方式有達成我的目的了 04/24 17:03
→ nobody1:appdelegate didFinishLaunchingWithOptions 中檢查 04/24 23:23
→ nobody1: UILocalNotification *localNotif =[launchOptions 04/24 23:23
→ nobody1:objectForKey:UIApplicationLaunchOptionsLocalNotificati 04/24 23:24
→ nobody1:nKey]; 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