问题描述
我正在为新的 Apple TV 构建 TVOS 应用程序,该应用程序需要从服务器获取通知以更新其显示.TVOS 不允许远程通知,当您尝试注册应用程序以接收远程通知时,它实际上会显示错误.
I am building a TVOS app for the new Apple TV that needs to get notifications from a server to update it's display. Remote notifications are not allowed with TVOS, and it actually displays an error when you try to register the app for remote notifications.
话虽如此,我需要的东西还有其他选择吗?
With this being said, are there any alternatives to what I need?
澄清:- 应用程序无限期地保持运行,显示一个显示.- 当用户向显示添加内容时,我想通知登录到同一用户的任何应用程序更新显示.- 我无法使用远程通知.
To clarify:- The app stays running indefinitely, showing a display.- When the user adds content to the display, I want to notify any apps that are logged in to the same user to update the display.- I cannot use remote notifications.
请让我知道这是否有意义,并提前感谢您的帮助!
Please let me know if this makes sense, and thank you in advance for your help!
推荐答案
注册错误的哪一部分适合您?通知对话框和横幅在 tvOS 上可能没有真正意义,但您可以发送 静默推送通知?注册这些所需要做的就是
What part of the registration errors out for you? Notification dialogs and banners may not really make sense on tvOS, but can you send a silent push notification? All you need to do to register for these is
[application registerForRemoteNotifications];
您不需要向用户显示请求对话框以获得静默通知的权限(但您确实需要拥有远程通知权限.)
You do not need to display the request dialog to the user for permission for silent notifications (you do need to have the remote notifications entitlement though.)
根据此处的 Apple 文档,他们允许 云套件.CloudKit 订阅依赖于我认为可以在 tvOS 上运行的静默推送通知(没有它们会严重削弱 CloudKit)
According to Apple's documents here, they allow CloudKit. CloudKit subscriptions rely on silent push notifications that I would assume would work on tvOS (without them it would severely cripple CloudKit)
如果这仍然不起作用,那么您可以创建自己的长轮询连接(本质上,您将制作自己的自定义推送通知).但是,它只能向已打开该应用的设备发送消息.
If that still does't work, then you could create your own long polling connection (essentially, you would be making your own custom push notifications). It would only be able to send messages to devices that have the app opened however.
这篇关于TVOS 远程通知更换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!