iPad Safari 上的 Firebase;找不到变量:通知

我使用 Firebase 的云消息传递,但它不适用于 iPad 和 iPhone.这是我能用它做的最简单的用法.我刚刚完成了所有关于异地通知的教程,但我直接在 Firebase 的脚本中得到了这个错误.

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.

推荐答案

您使用的 firebase JavaScript 库与 iOS 上的 Safari 不兼容.在 iOS 设备上运行的 Safari 浏览器与应用程序的桌面版本不同,并且没有相同的功能集.

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.

在这种特定情况下,iOS Safari 会在您的 firebase.js 库上抛出错误,尝试使用 Web 通知 API 的 requestPermission() 方法以允许 firebase 向用户显示通知.不过通知 API 不存在.

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.

您可以在此处查看对通知 API 的支持:http://caniuse.com/#search=Notification

You can see the support for the Notification API here: http://caniuse.com/#search=Notification

当在不支持它的移动设备上查看您的网络应用时,您可能需要查看替代方案或禁用 firebase 库.如果它应该在 iOS Safari 上运行,那么您应该向 Firebase 提交一个错误,并查看是否有可用的补丁或更新来解决 firebase.js 库中的问题.

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.

相关文章