phonegap ios和android中的多线程问题 [英] multi thread issue in phonegap ios and android
问题描述
大家好
请在这里查看我的代码。
Hi all
Please look at my code here.
function itmerStart()
{
if (timerId) return
timerId = setInterval(loadMessageListCron, 20000);
function loadMessageListCron()
{
var userid = window.localStorage.getItem("userId");
if(userid != undefined)
{
alert("thread calling..");
$.ajax("http://abc.com/Rest/get_all_messages?UserId="+ userid).done(function(data)
{
var i, response;
$.each(data.messages, function (i, response)
{
inboxMessageItmerStop(); insertMessages(response, i);
inboxMessageItmerStart();
});
});
}
}
}
我创建了这段代码来处理PhoneGap中的线程,但是如果我运行这段代码我会得到以下错误。
I had created this code to handle threads in PhoneGap, but if I run this code I am getting the following error.
"Thread 14 WebCore: Database: EXC_BAD_ACCESS (code = 1, address = Oxbbadbeef)"
我也在使用另一个看起来像我上面粘贴过的线程,突然间我的应用程序崩溃并获得相同的错误消息,我也想使用相同的多线程代码Android和IOS可以有人建议我更好的方法重用Android和IOS相同的代码?所以我在这里错过了什么,有人会建议一种方法来解决这个错误。
I am also using another thread which looks like the one which I had pasted above, suddenly my application crashes and getting the same error message, and I would also like to use the same multi thread code for both android and Ios could someone suggest me a better way to reuse the same code for both android and Ios? So what am I missing in this, could some one suggest a way to fix this error.
推荐答案
.ajax( http://abc.com/Rest/get_all_messages?UserId= + userid).done( function (数据)
{
var i,响应;
.ajax("http://abc.com/Rest/get_all_messages?UserId="+ userid).done(function(data) { var i, response;
.each(data .messages, function (i,response)
{
inboxMessageItmerStop(); insertMessages(response,i);
inboxMessageItmerStart() ;
});
});
}
}
}
.each(data.messages, function (i, response) { inboxMessageItmerStop(); insertMessages(response, i); inboxMessageItmerStart(); }); }); } } }
我创建了这段代码来处理PhoneGap中的线程,但是如果我运行这段代码我会得到以下错误。
I had created this code to handle threads in PhoneGap, but if I run this code I am getting the following error.
"Thread 14 WebCore: Database: EXC_BAD_ACCESS (code = 1, address = Oxbbadbeef)"
我也在使用另一个看起来像我上面粘贴过的线程,突然间我的应用程序崩溃并获得相同的错误消息,我也想使用相同的多线程代码Android和IOS可以有人建议我更好的方法重用Android和IOS相同的代码?那么我在这里错过了什么,有人会建议一种方法来解决这个错误。
I am also using another thread which looks like the one which I had pasted above, suddenly my application crashes and getting the same error message, and I would also like to use the same multi thread code for both android and Ios could someone suggest me a better way to reuse the same code for both android and Ios? So what am I missing in this, could some one suggest a way to fix this error.
这篇关于phonegap ios和android中的多线程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!