PhoneGap 1.2 run AJAX calls on main thread?

  • 1
  • Question
  • Updated 8 years ago
I have an app built using PhoneGap 1.2, and my iOS crash report seems to indicate the app is throwing a "watchdog timeout" (ref:https://developer.apple.com/library/i..., after 10 seconds, with the following reasons:

preventSuspend preventThrottleDownCPU preventThrottleDownUI

In the main thread (Thread 0), this is the error I'm seeing:

WebCore::ScriptExecutionContext::dispatchErrorEvent

I'm doing some research, and wondering if the PhoneGap API, specifically the "Connection" object, runs on the main thread, and could potentially cause the "synchronous" issue detailed here (see the section on "reachability"):

https://developer.apple.com/library/i...
Photo of Jeff

Jeff

  • 23 Posts
  • 0 Reply Likes

Posted 8 years ago

  • 1
Photo of Jeff

Jeff

  • 23 Posts
  • 0 Reply Likes
Found another developer with the same error message, being caused by database queries, while I believe mine is being caused by AJAX calls:

http://stackoverflow.com/questions/63...

The single thread seems to be the common theme.
Photo of Jeff

Jeff

  • 23 Posts
  • 0 Reply Likes
Ok, from the 2010 Apple Developer presentation "Session 208 - Network Apps for iPhone OS, Part 2", (start at the 5:46 mark) there's this:

"If you pass it (iOS) a HTTP url, it will go to the network, and if the network is not working properly, it can't return because it hasn't got the whole results yet. It can't error, because it hasn't yet timed out. It just sits there and waits, and the watchdog kills you".

If PhoneGap runs AJAX on the main thread, this is definitely causing my issue (and I would assume watchdog timeouts for anyone using AJAX in PhoneGap).
Photo of Andrew Lunny

Andrew Lunny

  • 1911 Posts
  • 199 Reply Likes
Thanks for the information - unfortunately, most of the PhoneGap (or Apache Cordova, as it's now known) iPhone developers don't read this forum.

You may want to post your findings on the PhoneGap mailing list, here:
http://groups.google.com/group/phonegap

Also, if you're able to write a quick script to reproduce this issue, you can post it on the issue tracker to ensure somebody has a look at it.