Search code examples
swiftnotificationstvos

TVOS remote notification replacement


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!


Solution

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