iOS 10 通知内容扩展未加载 [英] iOS 10 Notification Content Extension not loading

查看:24
本文介绍了iOS 10 通知内容扩展未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的应用程序来处理推送通知.我有通知服务扩展工作.我可以发送带有图像 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.

我似乎无法让通知内容扩展正常工作.我已经阅读了多个教程,他们都说,只需从目标菜单创建一个通知内容扩展,然后在通知内容扩展 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 块中确保类别与 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.

有什么想法吗?我该如何去调试这个?我试过在选择了通知扩展的情况下运行应用程序并打印出里面的内容

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 上不起作用.我借了 iPhone 6+ 和我的代码运行良好.

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.

这篇关于iOS 10 通知内容扩展未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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