I had a colleague try the same code as above a physical device and it works. So if you have been running on Simulator, I guess your only option is to shell out for an iPhone to test it. 🤷
Post
Replies
Boosts
Views
Activity
I'm having the same problem in 16.4 simulator. After adding the app to home screen and running:
try {
const permission = await Notification.requestPermission();
console.log('Successfully handled permission', permission);
} catch(e) {
console.error('Failed to register notification', e);
}
...I get back simply denied. Safari does not ask for the notification. This code works on every single modern except iOS Safari. 😢
If I try to run pushManager.subscribe() anyway, I get NotAllowedError: User denied push permission, so the status seems to be correct.
Also I do have a web manifest file with display: standalone, the only difference is mine uses the new .webmanifest format. Safari picks upp all the properties in the file correctly so I don't think it's related.
<link rel="manifest" href="/manifest.webmanifest" />