ios – 是否可以阻止显示远程通知?

ios – 是否可以阻止显示远程通知?,第1张

概述我想更好地控制向我的用户显示哪些通知,并有选择地使其中的一些静音.为了做到这一点,我在我的应用程序中实现了一个 UNNotificationServiceExtension,这允许我拦截和修改通知,即使我的应用程序没有运行.但问题是,即使我不调用didReceive(_:withContentHandler :),系统仍会在大约30秒后显示远程通知.我怎样才能防止这种情况发生? 从iOS 11开始 我想更好地控制向我的用户显示哪些通知,并有选择地使其中的一些静音.为了做到这一点,我在我的应用程序中实现了一个 UNNotificationServiceExtension,这允许我拦截和修改通知,即使我的应用程序没有运行.但问题是,即使我不调用dIDReceive(_:withContentHandler :),系统仍会在大约30秒后显示远程通知.我怎样才能防止这种情况发生?解决方法 从iOS 11开始,无法使用unnotificationserviceextension禁止显示推送通知. @H_403_11@

@H_403_11@在WWDC 17的Best Practices and What’s New in User Notifications中,Teja明确表示不能做这样的事情(从22:17分钟开始):

@H_403_11@

@H_403_11@All work should be either about modifying or enhancing this notification. The service extension also doesn’t have the power to drop this notification or prevent it from being displayed. This notification will get delivered to the device. If instead you want to launch your application in the background and run some additional processing,you should send a silent notification. You can also send a silent notification and launch your app in the background and your app can determine whether or not to schedule a local notification if you want to present a conditional notification.

总结

以上是内存溢出为你收集整理的ios – 是否可以阻止显示远程通知?全部内容,希望文章能够帮你解决ios – 是否可以阻止显示远程通知?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1067774.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存