web push with firebase ios devices

36 Views Asked by At

i have a problem with getToken function from firebase/messaging on ios platfrom in standalone application (on desktop (mac, windows) android everything is ok) my code

async function subscribe(closeModal: () => void) {
  const permission = await Notification?.requestPermission();
  if (permission === 'granted') {
    const messaging = await getMessaging(firebaseApp);
    const token = await getToken(messaging);
  }
}

my request for token (getToken) doesn't work. i tried setTimeout its also doesn't work, but if i put getToken and messaging in window object and run getToken(messaging) from console, everything is ok. help me please with this problem. firebase version - 10.7.1 tried - use setTimeout, run getToken after sw register

0

There are 0 best solutions below