我收到以下错误:
[INFO] : libc: Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 6895 (WebViewCoreThre)
在模拟器上向 webView 发送超过 700 个项目和向设备发送 200 个项目后,程序崩溃并自动重新启动。我花了很多天试图解决这个问题,但没有成功。
这可能是什么原因造成的?
如有必要,我可以发送一个完整的项目。在我的电子邮件 nilmarpublio@gmail.com 询问
我的代码是:
var count = 0;
//
// create base UI tab and root window
//
var win = Titanium.UI.createWindow({
title:'BtTest',
backgroundColor:'#eff2d8',
layout: 'vertical'
});
var mainView = Ti.UI.createView({
top: 0,
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
backgroundColor: '#7cd0F7',
});
var webView = Ti.UI.createWebView({
backgroundColor: 'white',
top:10,
left: 20,
height: 250,
width: 250,
cacheMode: Ti.UI.Android.WEBVIEW_LOAD_NO_CACHE,
borderColor: 'black',
url: 'html/stress.html'
});
mainView.add(webView);
var webView1 = Ti.UI.createWebView({
backgroundColor: 'black',
top:250,
left: 0,
height: 250,
width: Ti.UI.FILL,
cacheMode: Ti.UI.Android.WEBVIEW_LOAD_NO_CACHE,
borderColor: 'black',
url: 'html/stressChart.html'
});
mainView.add(webView1);
var xtm0 = 0;
function send(valor)
{
xtm0 = setInterval(function()
{
console.log(count++);
var valor = Math.floor(Math.random()*100);
Ti.App.fireEvent("app:fromGauge", {message: valor});
Ti.App.fireEvent("app:fromChart", {message: valor});
}, 500);
}
send();
win.add(mainView);
win.open();
HTML 文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gauge Test</title>
<script src="../js/gauge.js"></script>
<style>body
{
padding:0;
margin:0;
background:#a3a3a3
}
</style>
</head>
<body onload = "showGauge()">
<canvas id="gauge">
</canvas>
<div id="console">
</div>
<script>
function showGauge()
{
var gauge = new Gauge(
{
renderTo : 'gauge',
width : 250,
height : 250,
glow : true,
units : '%',
title : false,
minValue : 0,
maxValue : 100,
majorTicks : ['0', '20', '40', '60', '80','100'],
minorTicks : 20,
strokeTicks : false,
highlights : [
{ from : 0, to : 20, color : 'rgba( 255, 255, 255, 1)' },
{ from : 20, to : 40, color : 'rgba( 0, 201, 255, 1)' },
{ from : 40, to : 80, color : 'rgba( 255, 0, 130, 1)' },
{ from : 80, to : 100, color : 'rgba( 255, 0, 0, 1)' }
],
colors: {
plate : '#222',
majorTicks : '#f5f5f5',
minorTicks : '#ddd',
title : '#fff',
units : '#fff',
numbers : '#eee',
needle : { start : 'rgba(255, 32, 12, 1)', end : 'rgba(255, 167, 12, 1)' }
}
});
gauge.onready = function()
{
Ti.App.addEventListener("app:fromGauge", function(e)
{
var msg = e.message;
gauge.setValue(msg);
});
};
gauge.draw();
// inibe as barras de scroll
document.ontouchmove = function(event)
{
event.preventDefault();
};
};
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples: Real-time updates</title>
<link href="../flot/examples/examples.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../flot/examples/jquery.js"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="/js/flot/excanvas.min.js"></script><![endif]-->
<script type="text/javascript" src="../flot/examples/jquery.flot.js"></script>
<script type="text/javascript" src="../flot/examples/jquery.flot.time.js"></script>
<script type="text/javascript" src="../flot/examples/jshashtable-2.1.js"></script>
<script type="text/javascript" src="../flot/examples/jquery.numberformatter-1.2.3.min.js"></script>
<script type="text/javascript" src="../flot/examples/jquery.flot.symbol.js"></script>
<script type="text/javascript" src="../flot/examples/jquery.flot.axislabels.js"></script>
<script>
var data = [];
var dataset;
var totalPoints = 100;
var updateInterval = 1000;
var now = new Date().getTime();
function GetData() {
data.shift();
while (data.length < totalPoints) {
var y = Math.random() * 100;
var temp = [now += updateInterval, y];
data.push(temp);
}
}
var options = {
series: {
lines: {
show: true,
lineWidth: 1,
fill: false
}
},
xaxis: {
font:
{
size: 10,
style: "normal",
family: "sans-serif",
color: "black"
},
mode: "time",
tickSize: [2, "second"],
tickFormatter: function (v, axis) {
var date = new Date(v);
if (date.getSeconds() % 20 == 0) {
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
return (hours + ':' + minutes);
} else {
return "";
}
},
// axisLabel: "Time",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 8,
axisLabelFontFamily: 'Verdana',
axisLabelPadding: 10
},
yaxis: {
font:
{
size: 10,
style: "normal",
family: "sans-serif",
color: "black"
},
min: 0,
max: 100,
tickSize: 5,
tickFormatter: function (v, axis) {
if (v % 10 == 0) {
return v;
} else {
return "";
}
},
// axisLabel: "CPU loading",
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana',
axisLabelPadding: 6
},
legend: {
labelBoxBorderColor: "#fff"
},
grid: {
backgroundColor: "#000000",
tickColor: "#008040"
}
};
$(document).ready(function () {
// GetData();
dataset = [
{ data: data, color: "#00FF00" }
];
$.plot($("#flot-placeholder1"), dataset, options);
function update() {
$.plot($("#flot-placeholder1"), dataset, options);
}
Ti.App.addEventListener("app:fromChart", function(e)
{
var msg = e.message;
GetData(msg);
update();
});
document.ontouchmove = function(event)
{
event.preventDefault();
};
});
</script>
<!-- HTML -->
<div id="flot-placeholder1" style="width:200px; height:330px"> </div>
</head>
</html>