I use Firebase's cloud messaging, but it won't work on iPad and iPhone. It's the simplest usage i can do with it. I just did all the tutorial about offsite notifications but i got this error directly in the Firebase's script.
问题:
回答1:
The firebase JavaScript library you're using is incompatible with Safari on iOS. The Safari browser that runs on iOS devices is not the same as the desktop build of the application and does not have the same feature set.
In this specific case, iOS Safari is throwing an error on your firebase.js library attempting to use the Web Notification APIs requestPermission() method in order to allow firebase to show notifications to the user. The Notification API doesn't exist though.
You can see the support for the Notification API here: http://caniuse.com/#search=Notification
You may have to look at an alternative or disable the firebase library when your web app is viewed on mobile devices which don't support it. If it's supposed to work on iOS Safari then you should file a bug with Firebase and see if there's a patch or update available which resolves the issue in the firebase.js library.
回答2:
I have an answer from Firebase Support:
Hi there,
I hope you're doing well and thank you for reaching out to us. The FCM web API only supports the following browsers, and Safari is not one of them: Chrome: 50+ Firefox: 44+ Opera Mobile: 37+ We are exploring for potential solutions, but we don't have any details as of the moment. If you have any other questions or clarifications, just let us know. We'll try our best to help.
Regards, Resty