82

I've got a Progressive Web App which made with Blazor WebAssembly and I was wondering if I can send push notifications to iOS devices? Although people said if works now on Safari on MacOS, Push API's website says that it does not support Safari on iOS.

  • Do I need to wrap every web app if I target iOS? I don't have a MacBook, do I need to buy one just to achieve this?

  • Also there are Firebase and Azure Notification Hub, Can't I just use their service to send notifications for iOS? Firebase's had only Objective-C and Swift examples.

  • This also led to another question: Are notifications' way of transport is platform depended? I'm confused with cloud services' role on this.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Kaan Taze
  • 1,066
  • 1
  • 11
  • 19
  • 5
    Nope, Apple does not allow push notifications on iOS. You will have to fall back to SMS instead. – Chris Love Sep 10 '20 at 14:31
  • 1
    Does this answer your question? [How to send Push notification to iOS WebApp (PWA)?](https://stackoverflow.com/questions/60361646/how-to-send-push-notification-to-ios-webapp-pwa) – abraham Sep 13 '20 at 22:06
  • 1
    @abraham I've seen this question before posting mine. Unfortunately no. I'm now looking into deploying my WebAssembly app as mobile app rather than a PWA. – Kaan Taze Sep 14 '20 at 12:22
  • 2
    Our App got rejected by Apple. It is Insane that this still does not work with the latest iOS Version in 2021. – Daniel Ehrhardt May 23 '21 at 11:02
  • 2
    iOS 15.4 hints at AR/VR headset support and push notifications coming to web apps. https://9to5mac.com/2022/01/31/ios-15-4-hints-at-ar-vr-headset-support-and-push-notifications-coming-to-web-apps/ – pdorgambide Feb 01 '22 at 23:04
  • It's coming really soon in IOS 16[.](https://semicolon.dev/javascript/pwa-javascript-push-notifications-api-safari-ios-16) But you can try setting it up in IOS 15 under Safari Advanced / Experimental Settings (Turn the line that says "Push API" on.) – InfiniteStack Aug 28 '22 at 05:27
  • Does this answer your question? [iOS/iPadOS safari push api support](https://stackoverflow.com/questions/50692775/ios-ipados-safari-push-api-support) – Muhammad Dyas Yaskur Mar 29 '23 at 11:57

6 Answers6

157

You have only three main options to get push notifications working on iOS for a PWA. In both cases, you must register an App ID on Apple Developer portal, with permission to the appropriate service. For Option 1, your registered App ID must have permission to Apple Wallet. For options 2 and 3, you must have permission to Push Notifications. In both cases, you should record your Bundle ID and Team ID in case you need it later.

  • Option 1 (Easier): Use PassKit to set up a generic Apple Wallet pass, which can broker notifications that are very similar to native ones. Here's some documentation, and here's a working demo of how this can send push notifications to registered devices.

  • Option 2 (Harder): Use Firebase Cloud Messaging or a package like Node-APN to send push notifications the "proper" way, signed with a P12 or P8 key from the Apple Developer Portal. This gets tricky mainly because you need the iOS device identifier, which is only exposed to applications installed natively. I'm afraid I don't have an answer on how to get this device ID from within a PWA, and without it, this method doesn't work.

  • Option 3 (not a PWA): You can use an App ID with a provisioning profile and either a P12 or P8 key, similar to the previous option, but you wrap your application in Apache Cordova, and distribute it (either through the public app store, or using MDM software and via the private Apple Business Manager).

Those are your options. I have exhausted every possible avenue researching this, and I am confident that these will remain your only options through at least the next several months. It's possible we may see further support for Web Push or perhaps just a way to get the device ID from the web in the future, but until that time, this is it. There aren't any other ways to go about this presently.

Source: I architect and develop apps for major brands like Subway, Gartner, Morgan Stanley and PwC (among many others). My research is very recent, and includes direct communication with the head of WebKit at Apple, and also with one of the world's foremost PWA and iOS experts.

Crates
  • 2,362
  • 2
  • 19
  • 15
  • 26
    Thanks Kyle! I'm talking now with Maciej Stachowiak, head of WebKit at Apple, to see if they can expose the device ID to make Option 2 more viable. No guarantees yet, but hopefully we can see some movement on this option in 2021! – Crates Dec 22 '20 at 15:36
  • I don't understand what to do to test option 1. – user1948585 Jan 10 '21 at 15:21
  • 1
    May I ask for any updates on Option 2 ? Also, is it that the push notifications don't work on iOS if the user is using Safari (meaning that they work on chrome) or that they don't work on iOS (iPhones) regardless of the browser? – Ayudh Mar 14 '21 at 12:58
  • Can anyone please explain how to use Passkit in PWA, I don't think it's a relevant solution for PWA – ami solani Mar 31 '21 at 07:14
  • 1
    @Ayudh as far as I can tell (2020 iPhone SE with IOS 14), they do not work on any browser on IOS, so it's the phone, not the browser. – Barbaldo Jun 11 '21 at 10:53
  • 5
    @amisolani: They do work for PWAs, but they are a huge pain in the butt. We got them working for an application my current employer is using. There are several hoops to jump through and the user needs instruction on how to add the PassKit pass to their wallet. I don't especially recommend it given how much of a pain it was and how unreliable and inconsistent the notifications are. If I were you, I'd look at wrapping the app with Capacitor or Cordova. – Crates Jun 22 '21 at 14:13
  • @Crates would this API be enough to get the device ID: https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId – Vinícius Pacheco Vieira Aug 23 '21 at 17:58
  • 4
    -1 How this answers the question when #1 is a hack which requires more from the user than to just install the PWA to their home screen, and #2 and #3 are not about PWAs at all, and only work for native apps? – ruohola Nov 23 '21 at 13:15
33

I just want to let you all know: Apple will support push notifications for web apps! This news was published at the WWDC2022. Apple will release Web Push with Safari 16 on macOS (Ventura) in a few months (2022) and for iOS and iPadOS in 2023.

See: https://webkit.org/blog/12945/meet-web-push/

RuhrpottDev
  • 484
  • 5
  • 10
  • 3
    This is true, and possibly related to my discussions with the WebKit team at Apple about getting this added. I'm really glad to see they are putting this in. It's a huge step forward for PWAs! – Crates Jul 29 '22 at 19:31
  • Until this is working, I will use this Flutter wrapper: https://medium.com/@bettysteger/how-to-integrate-native-push-notifications-into-your-pwa-cdf07454ff06 – Betty St Sep 16 '22 at 22:28
  • 1
    @RuhrpottDev Will this update affect users with older ios devices or just the new devices? – Luca Pennisi Oct 21 '22 at 15:00
4

Push notifications have been announced for iOS 16.4 which should be released March 2023 and is currently available if you are part of their beta program.

I've written a tutorial showing how to implement them in a PWA.

Adam Berg
  • 71
  • 3
2

As of today, in iOS 16.4, Web Push is available to web apps after being added to the home screen.

Sidenote: in the Safari experimental feature settings, Push API is still disabled by default, but they will work in a web app, if the web app is added to the home screen.

0

It is here now, please check the official Safari release notes I have attached the link as well. Apple has just enabled web push notifications for Progressive Web Applications (PWAs) in iOS & iPadOS 16.4 beta 1.

Added support for Web Push in web apps saved to the home screen on iOS. Safari release notes link

Manik Kumar
  • 764
  • 7
  • 17
-1

I have a workaround to propose. If the PWA can send messages to a server and store them in the db, the watch app can always pull from the same server and display information. This is not the desirable solution, but my work.

touchydeer36
  • 132
  • 9