Notification requestPermission always returns denied

Hi,

I am trying out push notification for IOS 16.4 beta Simulator using 

Xcode 14.3 beta (14E5197f). Inside my JS code I have the following:

    Notification.requestPermission((permission) => {
console.log(permission);
    }).catch((error) => {
        deviceNotSupported();
    });
}

Unfortunately "permission" always returns "denied". Please kindly assist

Real device also returns 'denied' when it's actually 'granted' in my case.

I have the exact same problem running the same code which has been in the production for years and has been working perfectly for Android. Just installed iOS 16.4 (not beta!) on my physical iPhone 13 Pro.

I even get back "denied" in a situation where I see my PWA application under Settings having notifications allowed/enabled. It just seems that it doesn't matter if permissions are granted or not - result will be still "denied".

Update: Even after getting "denied" from Notification.requestPermission I can still subscribe to Push Notifications and receive those notifications so the problem seems to be only with the wrong result from Notification.requestPermission.

I can relate the same, when I try to use firebase I get the error: FirebaseError: Messaging: The notification permission was not granted and blocked instead. (messaging/permission-blocked).

This happens with ios 16.4, does anyone know a solution?

Same issue here and I also have firebase, can apple developers update us on what's wrong?

I have solved the issue on iOS 16.4 running on a real device by adding a manifest file. I have written about it in more detail here: https://developer.apple.com/forums/thread/725772?answerId=750249022#750249022

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" />

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

just use you iPhone.

in Simulator Notification requestPermission always returns denied

This problem seems to be resolved with the iOS 17 simulator

Notification requestPermission always returns denied
 
 
Q