Reactjs PWA初始屏幕无法在iOS上运行

时间:2019-04-10 20:52:37

标签: javascript html reactjs progressive-web-apps

我已经研究了一段时间,但由于某种原因而无法使其工作。我遵循了多个教程,并添加了我认为是正确的标签,但是没有显示初始屏幕。

规格:

  • iPhone 8 +
  • iOS 12.2

该应用是使用Reactjs制作的,并已启用服务工作者

我尝试卸载/重新安装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>

1 个答案:

答案 0 :(得分:1)

请参阅:PWA Tips and Tricks

iOS 为了使您的Progressive Web App在iOS设备上更加原生,可以添加一个自定义启动屏幕,该屏幕在用户启动您的应用程序时显示。

enter image description here

...