在模拟器中推送通知 - 不工作 Xcode 11.4beta [英] Push notifications in simulator - Not working Xcode 11.4beta

查看:27
本文介绍了在模拟器中推送通知 - 不工作 Xcode 11.4beta的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近 Apple 也在模拟器中添加了推送通知.模拟器中未收到我现有的应用程序通知.

Recently Apple has added push notifications in simulators as well. My existing app notifications are not being received in simulators.

如何在模拟器中模拟推送通知?

How to simulate push notification in simulator?

Simulator 支持模拟远程推送通知,包括后台内容获取通知.

Simulator supports simulating remote push notifications, including background content fetch notifications.

参考:https://developer.apple.com/documentation/xcode_release_notes/xcode_11_4_beta_release_notes

推荐答案

是的,你说得对.使用 Xcode 11.4:

Yes, you are right. With Xcode 11.4:

Simulator 支持模拟远程推送通知,包括后台内容获取通知.(xcode 11.4 发行说明)

Simulator supports simulating remote push notifications, including background content fetch notifications. (xcode 11.4 release notes)

您只需将一个有效的 APNs 文件拖放到你的模拟器.

You just need to drag&drop a valid APNs file onto your simulator.

但是,如果有人问为什么不调用 UNNotificationServiceExtension 的实例方法 didReceive(_:withContentHandler:) ,那是因为没有考虑属性 mutable-content".

However, if someone is asking why the instance method didReceive(_:withContentHandler:) of UNNotificationServiceExtension is not called, it's because the property "mutable-content" is not taking into account.

通知服务扩展在模拟推送通知中不起作用.不遵守可变内容键.(55822721)(xcode 11.4 发行说明)

Notification Service Extensions do not work in simulated push notifications. The mutable-content key is not honored. (55822721) (xcode 11.4 release notes)

总的来说,这意味着一个流畅的开发用例,即轻松测试丰富的推送通知 在带有模拟器的本地机器上将无法运行!

In total, this means that a smooth development use case, namely testing easily rich push notifications on local machine with simulator will not work!

这篇关于在模拟器中推送通知 - 不工作 Xcode 11.4beta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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