在iPhone上收到通知时(不是在点击并打开通知之后)将触发哪种方法? [英] Which method will be triggered when the notification received on iPhone(not after the notification is tapped and opened)?

查看:296
本文介绍了在iPhone上收到通知时(不是在点击并打开通知之后)将触发哪种方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在使用didReceiveRemoteNotification来获取从Parse推送的通知的有效负载,但是,只有在点击并打开通知时才会触发.

I’m now using didReceiveRemoteNotification to get the payload of the notification pushed from Parse, however, it is only triggered when the notification is tapped and opened.

我要执行的操作是启动警报以提醒用户通知已到达,因此我想didReceiveRemoteNotification不是我想要的.为此,我应该考虑哪种方法?

What I’m trying to do is start an alarm to remind the user that a notification has arrived, so I guess didReceiveRemoteNotification is not what I’m looking for. Which method should I look into for this purpose?

谢谢!

推荐答案

WWDC 2014上的单词 iOS通知中的新增功能

本地和推送通知使后台或不活动的应用程序可以通知用户发生了感兴趣的事件,或者应用程序具有针对他们的新信息.

WWDC 2013 多任务处理的新功能告诉我们如何进行这项工作.

The WWDC 2013 Whats New With Multitasking tells us how to get this work.

•在 info.plist

•从服务器发送时在您的有效载荷中添加`content-available:1

• add `content-available: 1 in your Payload while sending from server

•让iOS处理它以在后台模式下打开您的应用

• lets iOS handle it to open your app for background mode

对于iOS 10及更高版本,您必须从Target上打开Background Modes->在功能"下,选中所需字段.

For iOS 10 and above you have to switch ON the Background Modes from your Target -> Under Capabilities and check mark the required fields.

现在,您可以根据需要设置闹钟了.您可以设置排定的本地通知,直到用户与应用互动为止

Now you can set your alarm as you want. you may set a scheduled local notification until user interact with app

这篇关于在iPhone上收到通知时(不是在点击并打开通知之后)将触发哪种方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆