OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
74 stars 23 forks source link

[question]: React PWA working in macOS android but not iOS home screen app problem with init #111

Closed obbila closed 1 year ago

obbila commented 1 year ago

How can we help?

Hi,

Generally I have OneSignal working perfectly on macOS in browsers and on android but I am running into issues with the iOS home screen app.

I am triggering OneSignal.init in an async await function in my react pwa. This resolves fine in my osx browsers and android but not in iOS for some reason. I tried adding a .catch to the end of the init to no avail.

I think my manifest is fine as it is installing ok in both iOS and android and while I cannot check the Onesignal service worker in iOS I can track it in Chrome and all appears OK. Both manifest and sw are in my root folder of the pwa.

My manifest is:

{
    "short_name": "MyApp",
    "name": "MyApp",
    "icons": [
        {
            "src": "favicon.ico",
            "sizes": "64x64 32x32 24x24 16x16",
            "type": "image/x-icon"
        },
        {
            "src": "logo192.png",
            "type": "image/png",
            "sizes": "192x192",
            "purpose": "any maskable"
        },
        {
            "src": "logo512.png",
            "type": "image/png",
            "sizes": "512x512"
        }
    ],
    "start_url": ".",
    "display": "standalone",
    "theme_color": "#000000",
    "background_color": "#ffffff"
}

The only advice that I have seen online but have not really understood is that you have to register your sw in your index.js. Is this necessary? If so how should I do this for the OneSignalSDKWorker.js? I don't have any other sw running.

If you need any further details I will be happy to supply them.

obbila commented 1 year ago

Still struggling with this. Any ideas?

obbila commented 1 year ago

I am also getting this console log when I connect my iPhone to a developer console in Safari on my Mac:

OneSignal: Using fallback ES5 Stub for backwards compatibility.

Seems to be coming from : OneSignalShimLoader

obbila commented 1 year ago

Sorry being a dumb ass. My iPhone was running on 16.3....

All good now