Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all
Please look at my code here.
JavaScript
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();
         });
        });
        }
    }
}

I had created this code to handle threads in PhoneGap, but if I run this code I am getting the following error.
JavaScript
"Thread 14 WebCore: Database: EXC_BAD_ACCESS (code = 1, address = Oxbbadbeef)"

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.
Posted
Updated 14-May-14 20:09pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900