简体   繁体   English

iOS Web 应用程序不能在主屏幕应用程序中离线工作,但可以在 Safari 中工作

[英]iOS web app not working offline in homescreen app, but working in Safari

I have a basic create-react-app app that I tested on my iPhone 8 (through localhost).我有一个基本的create-react-app程序,我在我的 iPhone 8 上测试过(通过本地主机)。 The service worker registers properly when using Safari, but after adding the app to my homescreen and launching from there, the service worker doesn't work and I get the "Safari could not load the page because your iPhone is not connected to the internet" message. Service Worker 在使用 Safari 时正确注册,但是在将应用程序添加到我的主屏幕并从那里启动后,Service Worker 无法工作,我收到“Safari 无法加载页面,因为您的 iPhone 未连接到互联网”信息。 How can I fix this?我怎样才能解决这个问题?

Fixed it!修复!

For some reason, service workers work through localhost on iOS, but have weird behaviour unless they are hosted on an HTTPS host.出于某种原因,服务工作者在 iOS 上通过 localhost 工作,但除非他们托管在 HTTPS 主机上,否则会有奇怪的行为。 I was able to fix this problem (and one other where an image wasn't loading after disappearing and reappearing) by hosting the production build on a DigitalOcean server.通过在 DigitalOcean 服务器上托管生产版本,我能够解决这个问题(还有一个图像在消失和重新出现后没有加载的问题)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS移动网络应用程序(通过保存页面到主屏幕)离线可用性 - iOS Mobile Web App (via saving page to homescreen) offline availability 离线网络应用无法在iPhone上运行 - Offline web app is not working on iphone iOS:添加到主屏幕的Web应用程序无法在离线模式下运行 - iOS: Web app added to home screen not working in offline mode 如何使FirebaseSimpleLogin Facebook登录在全屏/主屏iOS Web App中工作 - How to get FirebaseSimpleLogin Facebook login working in a fullscreen/homescreen iOS Web App HTML5网络应用程序不在iOS Safari中缓存以供离线使用 - HTML5 web app not caching in iOS Safari for offline use 如何为Web应用程序设置脱机清单以在iOS的Safari中运行? - How to set up offline manifest for a web app to run in Safari in iOS? iOS主屏幕Web应用未显示更新 - iOS Homescreen Web App Not Showing Updates 安装解析通知后,iOS应用无法离线工作-Xcode - iOS app not working offline after installing parse notifications - xcode 在Android和iOS应用中同步离线工作数据的方法 - Ways to have synced offline working data in Android and iOS app 从iOS主屏幕启动的React Web App怪异行为 - React Web App launched from iOS homescreen weird behavior
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM