iOS 12 网页推送通知
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50692775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iOS 12 web push notifications
提问by Niccolò Fanton
Does the new iOS 12 safari support web push notification with service worker? In the last version of iOS there was service worker but there wasn't the pushManager object.
新的 iOS 12 safari 是否支持 Service Worker 的网络推送通知?在 iOS 的最后一个版本中,有 service worker 但没有 pushManager 对象。
采纳答案by Muhammad Dyas Yaskur
iOS 12 and 13 still doesn't support these features:
iOS 12 和 13 仍然不支持这些功能:
- Web Push Notification
- Background Sync
- Page Lifecycle
- Service Workers on WebViews
- Universal Links / Link Capturing
- 网页推送通知
- 后台同步
- 页面生命周期
- WebView 上的 Service Worker
- 通用链接/链接捕获
I think iOS doesn't want to support these in PWA because these features have a bigger chance to be unnecessary exploited(spam, etc). And also maybe they want to force developers to create the native application rather than the progressive web application.
我认为 iOS 不想在 PWA 中支持这些,因为这些功能有更大的机会被不必要地利用(垃圾邮件等)。也可能他们想强迫开发人员创建本机应用程序而不是渐进式 Web 应用程序。
回答by Anand
iOS don't support the W3C Spec web push notifications yet. But there is a Safari specific API for web notifications. Refer to this answer on multiple options you have.
iOS 尚不支持 W3C 规范网络推送通知。但是有一个用于 Web 通知的 Safari 特定 API。有关您拥有的多个选项,请参阅此答案。
https://stackoverflow.com/a/49803408/1057093
https://stackoverflow.com/a/49803408/1057093
Update:Corrected the Answer in the above link to clarify proprietary solution is only for OS X - Safari and no solution for iOS Safari yet. Custom in app notification is the best we can do today for iOS Safari.
更新:更正了上述链接中的答案,以阐明专有解决方案仅适用于 OS X - Safari,尚无适用于 iOS Safari 的解决方案。自定义应用程序通知是我们今天可以为 iOS Safari 做的最好的事情。
回答by Adrien
I tested iOS 12 in beta last week and as Anand said, there is no change about this functionnality and more globally for Progressive Web App because the Web Manifest, in developpement at this moment is not implemented yet.
我上周在 Beta 版中测试了 iOS 12,正如 Anand 所说,渐进式 Web 应用程序在此功能上没有任何变化,而且在全球范围内更是如此,因为此时开发中的 Web 清单尚未实现。