简体   繁体   English

iOS中的本地通知(目标C)

[英]Local Notification in iOS(Objective C)

我已将本地通知安排在明天的上午10点,我关闭了手机,然后在明天的第二天打开了手机。这时,通知仍未收到。但是,如果我在安排的日期之后就可以接收通知了和时间。因此,一旦超过iOS中的预定日期和时间,就可以获得通知吗?

Could you please rephrase your question? 你能再说一遍你的问题吗?

From what I understand you say that your local notification is not delivered if the device was not turned on at the scheduled time. 据我了解,您说,如果未在计划的时间打开设备,则不会发送本地通知。

In general, your local notifications are not handled by your app. 通常,您的本地通知不会由您的应用处理。 When you register a local notifiction, iOS is responsible for delivering it. 当您注册本地通知时,iOS负责传递它。 This also means that your app does not have to be running when your local notification is scheduled to be delivered. 这也意味着当您计划发送本地通知时,您的应用不必运行。

When your local notification was meant to be delivered at 10 AM, but your device was turned off from 9:50 to 10:10 AM, your local notification will be lost! 当您的本地通知原定于上午10点发送,但您的设备从9:50到10:10 AM关闭时,您的本地通知将会丢失!

Your app should not rely on delivering that local notification. 您的应用不应依赖于传递该本地通知。 Your only way of knowing whether a user received your local notification is when he opens your app by clicking on the notification or using one of its actions. 知道用户是否收到本地通知的唯一方法是,通过单击通知或使用其中一项操作来打开您的应用程序。 Your app will then be called by application:didReceiveLocalNotification when it is in the background, or regular by application:didFinishLaunchingWithOptions: when it was killed before. 然后,您的应用在后台运行时将被application:didReceiveLocalNotification调用,或者在之前被杀死时被application:didFinishLaunchingWithOptions:常规调用。

TL;DR: You should not care whether a user received a local notification, as there is no way to make sure he receives it under certain conditions. TL; DR:您不必在乎用户是否收到本地通知,因为在某些情况下无法确保用户收到本地通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM