当应用程序处于后台时处理本地通知
我的应用程序在收到本地通知时会在核心数据中插入一个条目。
这在以下场景中效果很好。
- 应用程序正在运行并且可见。
- 应用程序处于后台或根本没有运行,但是当点击“查看”时收到通知。
但如果我单击“关闭”,则不会进行任何输入。我在 AppDelegate 的“didReceiveLocalNotification”和“didFinishLaunchingWithOptions”中添加了插入方法。
有人可以详细说明如果我们关闭通知将调用什么方法吗?
My app inserts an entry in Core Data when it receives local notifications.
This works fine in the following scenarios.
- App is running and visible.
- App is in background or not running at all, but when "View" is tapped on receiving notification.
But if I click on "Close", no entry is made. I've added the insert method in the "didReceiveLocalNotification" and "didFinishLaunchingWithOptions" of the AppDelegate.
Can anybody elaborate on what method will be called if we close a notification?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,点击本地通知上的“关闭”只会关闭通知,而不会调用应用程序。
但是发送通知时不能插入数据吗?
As far as I understand, tapping "Close" on a local notification will just close the notification and not call the app.
But can't you insert your data when you send the notification?