【问题标题】:Reactjs PWA splash screen not working on iOSReactjs PWA 闪屏在 iOS 上不起作用
【发布时间】:2019-04-10 20:52:36
【问题描述】:

我已经为此工作了一段时间,但由于某种原因无法使其正常工作。我遵循了多个教程并添加了我认为正确的标签,但没有显示启动画面。

规格:

  • iPhone 8+
  • iOS 12.2

该应用是使用 Reactjs 制作的,并且启用了 service worker

我已尝试卸载/重新安装 PWA、清除浏览器数据并重新启动设备。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="description" content="TimeCard application.">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1,viewport-fit=cover"
    />
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <meta name="theme-color" content="#2A2B3A"/>

    <meta name="apple-mobile-web-app-capable" content="yes" >
    <meta name="apple-mobile-web-app-status-bar-style" content="default">

    <link rel="icon" sizes="192x192" href="%PUBLIC_URL%/app_icon_192.png">
    <link rel="icon" sizes="512x512" href="%PUBLIC_URL%/app_icon.png">
    <link rel="apple-touch-icon" sizes="192x192" href="%PUBLIC_URL%/app_icon_192.png">
    <link rel="apple-touch-icon" sizes="512x512" href="%PUBLIC_URL%/app_icon.png">

    <link href="%PUBLIC_URL%/splashscreens/iphone5_splash.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />

    <link href="%PUBLIC_URL%/splashscreens/iphone6_splash.png" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />

    <link href="%PUBLIC_URL%/splashscreens/iphoneplus_splash.png" media="(device-width: 621px) and (device-height: 1104px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image" />

    <link href="%PUBLIC_URL%/splashscreens/iphonex_splash.png" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/iphonexr_splash.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/iphonexsmax_splash.png" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/ipad_splash.png" media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/ipadpro1_splash.png" media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/ipadpro3_splash.png" media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
    
    <link href="%PUBLIC_URL%/splashscreens/ipadpro2_splash.png" media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />

    <title>TimeCard</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
  </body>
</html>

【问题讨论】:

  • 尝试将启动画面移动到清单文件

标签: javascript html reactjs progressive-web-apps


【解决方案1】:

见:PWA Tips and Tricks

iOS 为了让您的 Progressive Web App 在 iOS 设备上更接近原生,您可以添加一个自定义启动画面,在用户启动您的应用时显示。

...

【讨论】:

  • 我基本上已经完成了所有工作,但仍然无法正常工作:/ 也许是服务人员导致了问题。我必须禁用它并重试。
  • 您是否按照post 中的步骤并使用推荐的工具来创建图像和标记?
  • 这对我有用,但之前没用,因为我的 2 张图片尺寸错误。您必须完全按照尺寸进行操作。
猜你喜欢
  • 2019-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-18
  • 2018-12-11
  • 1970-01-01
相关资源
最近更新 更多