iOS 8 Bug - 当设备从睡眠状态返回时,OnUpdateReady永远不会再次调用 [英] iOS 8 Bug - OnUpdateReady never called again when device returns from sleep

查看:108
本文介绍了iOS 8 Bug - 当设备从睡眠状态返回时,OnUpdateReady永远不会再次调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当运行Web应用程序的iOS 8设备(即从主屏幕上的快捷方式启动)从其睡眠状态返回时,所有异步Web请求都无法触发OnUpdateReady回调。

When an iOS 8 device running a Web Application (i.e. launched from a shortcut on the Home Screen) returns from it's Sleep state all asynchronous web requests made fail to trigger the OnUpdateReady callback.

问题很容易重现 - 只需将下面的两个代码文件放在任何网络服务器上并尝试一下。

The problem is quite easy to reproduce - simply put the two code files below on any web server and give it a try.

还有其他人遇到过这个问题?如果是这样有任何解决方法吗?

Has anyone else run into this issue? If so is there any workarounds?

我发布这个是为了吸引人们注意iOS 8中的这个基本上毁了我所有网络应用程序的错误 - 我们'我不得不建议不要升级到iOS 7之外。是的,我已经在Apple Bug Reporter上发布了这个问题,但我认为没有人会看到这些问题,因为它已经很长时间了。

I'm posting this to try to attract attention to this bug in iOS 8 that has essentially ruined all of my web applications - we've had to recommend to NOT upgrade beyond iOS 7. And yes, I've posted the problem on Apple Bug Reporter but I think no one is looking at these since it has been a long time.

app.manifest

app.manifest

CACHE MANIFEST
# 2014-09-24 - Test

CACHE:
default.html

default.html

default.html

<!DOCTYPE html>
<html manifest="app.manifest">
<head>
  <title>Test Harness</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
  <meta name="HandheldFriendly" content="true" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <script language="javascript" type="text/javascript">
    var Test = new function () {
      var _GetEnd = function (oResult) {
        var sResult = ': ' +
          ((oResult.Value === true)
            ? 'Success'
            : 'Failure<br>' + oResult.Reason) +
          '<br>';

        var oLog = document.getElementById('idLog');
        oLog.innerHTML = (new Date()) + sResult + oLog.innerHTML

        setTimeout(_GetBegin, 1000);
      };

      var _GetBegin = function () {
        var sURL = 'app.manifest';
        var hAsyncCallback = _GetEnd;

        try {
          var oRequest = new XMLHttpRequest();
          oRequest.onreadystatechange =
            function () {
              if (oRequest.readyState != 4) return;
              if (oRequest.status != 200) {
                hAsyncCallback({ Value: false, Reason: oRequest.responseText });
              } else {
                hAsyncCallback({ Value: true, Reason: null });
              }
            };
          oRequest.open('GET', sURL, true);
          oRequest.send(null);
        } catch (e) {
          alert('Critical Error: ' + e.message );
        }
      };

      this.Start = function () { _GetBegin(); }
    };
  </script>
</head>
<body onload="Test.Start();">
  <ol>
    <li>Put both app.manifest and default.html on a web server.</li>
    <li>Make sure this page is being launched from the Home screen as a web application.</li>
    <li>Press the sleep button while it is running.</li>
    <li>Press the wake button and unlock the phone to get back to this screen.</li>
    <li>Under iOS7x the page continues, under iOS8 the onreadystatechange never gets called again.</li>
  </ol>
  <div id="idLog"></div>
</body>
</html>


推荐答案

安装iOS 8.1.1修复此问题。

Installing iOS 8.1.1 fixes this.

这篇关于iOS 8 Bug - 当设备从睡眠状态返回时,OnUpdateReady永远不会再次调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆