I'm working on a iPad app that is mainly a web view. It is served a web app that uses jQuery mobile, iScroll and some minor plugins. The only two plugins that is consistent troughout the app are jQuery mobile and iScroll, so i won't list all the small ones since the same crash can be triggered across the app under all kinds of different circumstances.
The real problem I have is that the only message xCode gives me is a trace of what WebCore is doing exactly before the crash. And i can't make heads or tails of it. I've been looking around all day for a solution to my problems but haven't found anything.
The output looks like this:
1 WebCore::ScriptExecutionContext::destroyedActiveDOMObject(WebCore::ActiveDOMObject*)
2 WebCore::ActiveDOMObject::~ActiveDOMObject()
3 WebCore::SuspendableTimer::~SuspendableTimer()
4 WebCore::DOMTimer::~DOMTimer()
5 WebCore::DOMTimer::removeById(WebCore::ScriptExecutionContext*, int)
6 WebCore::DOMWindow::clearTimeout(int)
7 WebCore::jsDOMWindowPrototypeFunctionClearTimeout(JSC::ExecState*)
8 JSC::Interpreter::privateExecute(JSC::Interpreter::ExecutionFlag, JSC::RegisterFile*, JSC::ExecState*)
9 JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
10 JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
11 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*)
12 WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul>&)
13 WebCore::EventTarget::fireEventListeners(WebCore::Event*)
14 WebCore::Node::handleLocalEvents(WebCore::Event*)
15 WebCore::EventContext::handleLocalEvents(WebCore::Event*) const
16 WebCore::EventDispatcher::dispatchEvent(WTF::PassRefPtr<WebCore::Event>)
17 WebCore::EventDispatchMediator::dispatchEvent(WebCore::EventDispatcher*) const
18 WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WebCore::EventDispatchMediator const&)
19 WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>)
20 WebCore::EventTarget::dispatchEvent(WTF::PassRefPtr<WebCore::Event>, int&)
21 WebCore::EventHandler::dispatchTouchEvent(WebCore::PlatformTouchEvent const&, WTF::AtomicString const&, WTF::HashMap<WebCore::EventTarget*, WTF::Vector<WTF::RefPtr<WebCore::Touch>, 0ul>*, WTF::PtrHash<WebCore::EventTarget*>, WTF::HashTraits<WebCore::EventTarget*>, WTF::HashTraits<WTF::Vector<WTF::RefPtr<WebCore::Touch>, 0ul>*> > const&, float, float)
22 WebCore::EventHandler::handleTouchEvent(WebCore::PlatformTouchEvent const&)
23 WebCore::EventHandler::touchEvent(WebEvent*)
24 -[WebHTMLView touch:]
25 -[WAKView _handleEvent:]
26 _ZL13eventCallbackP6WKViewP8WebEventPv
27 _WKViewHandleEvent
28 WKWindowSendEvent
29 -[UIWebBrowserView _dispatchWebEvent:]
30 -[UIWebBrowserView _webTouchEventsRecognized:]
31 -[NSObject performSelector:withObject:]
The only real error I'm getting is Thread 1: Program received signal: "EXC_BAD_ACCESS"
Thanks in advance, I'm glad for any help. Just point me in the right direction.
Ok, so it seems that i finally solved the problem. Thought i would share it here.
I still don't know exactly what made the application crash, but the fix i figured out seems to have solved the issue.
So since all i got in the output in xcode was something from webkits core (at least i figured as much with my limited knowledge about this), this led me to start looking at the website that is feeding the webview.
I've read a lot about problems with html5 video in mobile devices so i started to look there. I turned of all JavaScript and fed the site a single html 5 video element. All went fine, though when adding back jQuery-mobile the crashes returned as soon as i tried scrolling at the same time as the video was playing.
I know from before that there are some problems with using poster images on iOS devices. So i removed this, well that did the trick.
So to sum this up:
This is what i had:
<video class="videoSignPlayer" poster="poster.jpg" width="768" height="512" style="display:none;">
<source src="movie.mp4" width="768" type='video/mp4;
codecs="avc1.4D401E, mp4a.40.2"' />
</video>
This is the working markup:
<video class="videoSignPlayer" width="768" height="512" style="display:none;">
<source src="movie.mp4" width="768" type='video/mp4;
codecs="avc1.4D401E, mp4a.40.2"' />
</video>
Simple Fix.
It seems like there is a problem with having the poster attribute on a video element when using jQuery-mobile.
(And yes, i also tried preloading the poster image in a <img>
tag. The only solution to the crashes was to completly remove the poster attribute on the <video>
tag.)