热门代码推送破坏了应用程序

时间:2015-07-27 05:48:29

标签: javascript ios mobile meteor

我正在meteor中构建应用程序并尝试将其部署到iOS。在某一点上,一切都很顺利。我可以构建我的应用程序并将其放到设备上。我可以运行应用程序,一切都按预期工作。

现在奇怪的部分:

当我将新版本的应用程序推送到服务器(托管在数字海洋,而不是免费的meteor.com服务器上)时,它会提取所有新资产(我已经在js调试控制台中观看了它在模拟器中)然后变成空白。它还提供了一个错误,它无法解析某些文件。我检查了DOM并点击了css和js文件。它们与索引文件的html相同,但以不同的方式打破。只有在更新css文件时才会影响Css。只有在更新js文件时,Js才会受到影响。

我可以通过删除应用程序并重新安装来解决此问题,但这对我的用户来说是非常不受欢迎的。如果应用程序突然变为空白,他们将不知道这样做。我想继续使用热代码推送来更新应用程序,因此完全放弃它不是一种选择。

现在甚至更奇怪的东西:

流星构建过程连接并缩小项目的所有css和js,在其上打一个唯一的名称并将其放入应用程序index.html文件中。当我对服务器执行更新时,index.html文件不会更改!它与旧文件保持一致。 css和js的唯一标识符相同。

我的理论:

index.html文件(或至少是连接和缩小的css和js文件的唯一标识符)正在某处缓存,并且在热代码推送发生时不会更新。

我已经在GitHub上研究了这个问题并找到了类似的here

以下是ACTUAL' js'热代码推送后由应用程序提供的文件(你不会认为它不是js,而是半破坏的html,它是index.html的副本)。

我知道这个HTML格式错误。
这是我的问题,我没有写。它由流星自动构建 这正是它来自内置产品的方式。



<!DOCTYPE html >
< html >
< head >
< meta charset = "utf-8" >
< meta name = "format-detection" content = "telephone=no" >
< meta name = "viewport" content = "user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" >
< meta name = "msapplication-tap-highlight" content = "no" >
< link rel = "stylesheet" type = "text/css" class = "__meteor-css__" href = "/ea9d1dad4a77431e53e11a9fc699dfac92346452.css?meteor_css_resource=true" >
< script type = "text/javascript" >
__meteor_runtime_config__ = JSON.parse(decodeURIComponent("%7B%22meteorRelease%22%3A%22METEOR%401.1.0.2%22%2C%22PUBLIC_SETTINGS%22%3A%7B%22othersetting%22%3A%22anothervalue%22%7D%2C%22ROOT_URL%22%3A%22http%3A%2F%2Fnbt.otterhive.com%2F%22%2C%22ROOT_URL_PATH_PREFIX%22%3A%22%22%2C%22autoupdateVersion%22%3A%226705fea274dc86fd9c030412dd1f67bdfb4764d1%22%2C%22autoupdateVersionRefreshable%22%3A%227bcd7c6202871dd5313c15a8b87da110997f2c80%22%2C%22autoupdateVersionCordova%22%3A%2246143d47225e20f616f663860b06e155b01a6107%22%2C%22DDP_DEFAULT_CONNECTION_URL%22%3A%22http%3A%2F%2Fnbt.otterhive.com%2F%22%7D"));

if (/Android/i.test(navigator.userAgent)) {
    // When Android app is emulated, it cannot connect to localhost,
    // instead it should connect to 10.0.2.2
    // (unless we're using an http proxy; then it works!)
    if (!__meteor_runtime_config__.httpProxyPort) {
        __meteor_runtime_config__.ROOT_URL = (__meteor_runtime_config__.ROOT_URL || '').replace(/localhost/i, '10.0.2.2');
        __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = (__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL || '').replace(/localhost/i, '10.0.2.2');
    }
}
< /script>
< script type = "text/javascript" src = "/cordova.js"></script>
< script type = "text/javascript" src = "/e2c72dd7569f33c0169c66320f3f1e60cce07f3d.js"></script>

< meta charset = "utf-8" >
< meta http - equiv = "X-UA-Compatible" content = "IE=edge" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > Nature Based Therapeutics < /title>
< /head>
< body >

< /body>
< /html>
&#13;
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="format-detection" content="telephone=no">
  <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
  <meta name="msapplication-tap-highlight" content="no">

  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/ea9d1dad4a77431e53e11a9fc699dfac92346452.css?meteor_css_resource=true">

  <script type="text/javascript">
    __meteor_runtime_config__ = JSON.parse(decodeURIComponent("%7B%22meteorRelease%22%3A%22METEOR%401.1.0.2%22%2C%22PUBLIC_SETTINGS%22%3A%7B%22othersetting%22%3A%22anothervalue%22%7D%2C%22ROOT_URL%22%3A%22http%3A%2F%2Fnbt.otterhive.com%2F%22%2C%22ROOT_URL_PATH_PREFIX%22%3A%22%22%2C%22autoupdateVersion%22%3A%226705fea274dc86fd9c030412dd1f67bdfb4764d1%22%2C%22autoupdateVersionRefreshable%22%3A%227bcd7c6202871dd5313c15a8b87da110997f2c80%22%2C%22autoupdateVersionCordova%22%3A%2246143d47225e20f616f663860b06e155b01a6107%22%2C%22DDP_DEFAULT_CONNECTION_URL%22%3A%22http%3A%2F%2Fnbt.otterhive.com%2F%22%7D"));

    if (/Android/i.test(navigator.userAgent)) {
      // When Android app is emulated, it cannot connect to localhost,
      // instead it should connect to 10.0.2.2
      // (unless we're using an http proxy; then it works!)
      if (!__meteor_runtime_config__.httpProxyPort) {
        __meteor_runtime_config__.ROOT_URL = (__meteor_runtime_config__.ROOT_URL || '').replace(/localhost/i, '10.0.2.2');
        __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = (__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL || '').replace(/localhost/i, '10.0.2.2');
      }
    }
  </script>

  <script type="text/javascript" src="/cordova.js"></script>
  <script type="text/javascript" src="/e2c72dd7569f33c0169c66320f3f1e60cce07f3d.js"></script>


  <meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Nature Based Therapeutics</title>
</head>

<body>
  
</body>
</html>
&#13;
&#13;
&#13;

0 个答案:

没有答案