iOS 10通知内容扩展未加载

人气:700 发布:2022-10-16 标签: apple-push-notifications swift push-notification ios10 unnotificationrequest

问题描述

我有一个玩推式通知的准应用程序.我有Notification Service Extension正常工作.我可以发送带有图像URL的远程通知并加载它.

I have a bare-bones app to play with push notifications. I have the Notification Service Extension working. I can send a remote notification with an image URL and have it load.

我似乎无法使Notification Content Extension正常工作.我已经看过多个教程,他们都说,只需从目标菜单创建一个Notification Content Extension,然后在Notification Content Extensions Info.plist内设置

I can't seem to get Notification Content Extension working. I've gone through multiple tutorials and they all say, just create a Notification Content Extension from the target menu and then inside the Notification Content Extensions Info.plist set the

UNNotificationCategory

到一些字符串.然后,当您推送通知时,请确保在"aps" json-block内具有与UNNotificationCategory相同的类别.

to some string. Then when you push the notification, inside the "aps" json-block make sure to have category the same as UNNotificationCategory.

当我收到通知时,我尝试将其向左或向右滑动,但实际上没有任何反应.但是,服务扩展的效果很好.

When I receive a notification, I try to swipe it down, left or right and nothing really happens. However, the service extension is working great.

我正在使用具有ios 10和XCode 8.0的iPhone 5.我读到一点,只有具有3d触摸功能的设备才能查看内容扩展名,但是自从xCode 8退出测试版以来,这种情况已经改变.

I am using an iPhone 5 with ios 10 and XCode 8.0. I read that at one point only devices with 3d touch could view the content extension but that has since changed since xCode 8 is out of beta.

有什么想法吗?我该如何调试呢?我尝试在选择了Notification Extension的情况下运行该应用,并在

Any ideas? How can I go about debugging this? I've tried running the app with the Notification Extension selected and printing out stuff inside

didReceive

但是没有运气.

推荐答案

尽管我在stackoverflow和在线上的其他地方读到了什么,但扩展推送通知在iPhone 5和IOS 10上却不起作用.代码工作正常.

Despite what I read elsewhere on stackoverflow and online, expanding the push notification did not work on an iPhone 5 and IOS 10. I borrowed an iPhone 6+ and my code worked fine.

993