Can a local notification trigger code in iOS8?

旧巷老猫 提交于 2019-12-02 06:33:15

Yes and no.

If the notification is delivered when the app is in the foreground, it is delivered to you (the app), not to the user, so you will know in that way.

If is delivered when the app is not in the foreground, the app is not running so there is no one to tell. The app is not going to launch / wake you just to tell you that the notification took place. As you rightly imply, if the user asks the notification to contact you, you will be contacted, but otherwise, no.

However, you get an event when the app comes to the front once again, so you can always look to see whether the notification time happened "while you were out".

(Also note that the notification might never be delivered to the user. The user can just turn off notifications. It is risky to rely on them completely.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!