TVOS remote notification replacement

跟風遠走 提交于 2019-12-22 10:52:51

问题


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!


回答1:


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.)

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.




回答2:


I guess you can have the app poll a web server at a given interval to check if any updates have been made...



来源:https://stackoverflow.com/questions/33191951/tvos-remote-notification-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!