PDA

View Full Version : [FIXED] Using any animations with phonegap breaks app.



justinKohactive
15 Oct 2011, 8:36 PM
Anytime i specify an animation or use a tabpanel with phonegap, the app breaks. Ideas?

justinKohactive
16 Oct 2011, 1:18 PM
This seems to happen in 0.9.5.1 and 1.1.0 i also tried upgrading to xcode 4.2 it seems to have to do pottential with the iframe that is created as part of the animation? no idea. Heres a sample project and a video of what i keep experiencing.

Project: http://cl.ly/AymV

Video: http://cl.ly/AzL7

olouvignes
16 Oct 2011, 1:35 PM
I'm using a TabPanel with ST 2.0, Xcode 4.2 & Phonegap 1.10 with no issues (in the simulator at least). Something must be wrong somewhere.

justinKohactive
16 Oct 2011, 1:37 PM
I am at a loss man, i built a brand new project. Could my xcode be hosed? i've tried a couple version of phone gap etc.

justinKohactive
16 Oct 2011, 1:39 PM
Strangley enough it works with the ios 5 sdk but not the 4.3

olouvignes
16 Oct 2011, 1:44 PM
Ok, it seems that there is an ST 2.0 bug with IOS < 5, your app does break on 4.3 simulator.

Did test my own app. It does not start at all on 4.3... Great news...

justinKohactive
16 Oct 2011, 1:58 PM
Woot. i can confirm it does work with the ios 5.0 sdk. Thats good enough for now. I think it has to do with the UIWebView lacking a window.requestAnimationFrame

olouvignes
16 Oct 2011, 3:28 PM
Maybe this could be helpful for a fix :

https://gist.github.com/1002116

olouvignes
24 Oct 2011, 2:30 AM
Just spent a couple of hours on this. Found out this :

It does not crash on IOS4.3 Safari, but it does crash on IOS4.3 Webview (from Phonegap).
Found out that it does crash on :


Ext.fx.runner.CssTransition::getTestElement()
L.45197 on sencha-touch-all-debug-w-comments.js


More precisely this line is causing the crash :


iframeDocument.body.appendChild(testElement);
L.45215 on sencha-touch-all-debug-w-comments.js

This function seems to create an iframe, and put content inside it.
Problem is iframeDocument.body is null/undefined on IOS 4.3 while it is a "HTMLBodyElementConstructor" on IOS5.

Strangely, any check on it seems to crash the JS, tried :


if(!iframeDocument || !iframeDocument.hasOwnProperty('body')) {}
and it does not pass this test... !

This fix is critical to me (& i guess most of the ST2.x early adopters).
It would be great to get some help on this.
I'm looking for a quick fix/patch.

Please help !

olouvignes
24 Oct 2011, 2:55 AM
Found a fix !

Patch your sencha-touch-all-debug-w-comments.js :

- at line 45212, after "iframeDocument = iframe.contentDocument;"




document.body.appendChild(iframe);
iframeDocument = iframe.contentDocument;

// START PATCH

// Fix for iOS < 5.0
if(Ext.os.is.iOS && !Ext.os.is.iOS5) {
iframeDocument.open();
iframeDocument.writeln('</body>');
iframeDocument.close();
}

// END PATCH

this.testElement = testElement = iframeDocument.createElement('div');
testElement.style.position = 'absolute !important';


Done :-)

Hope it helps someone...

justinKohactive
24 Oct 2011, 7:48 AM
Found a fix !

Patch your sencha-touch-all-debug-w-comments.js :

- at line 45212, after "iframeDocument = iframe.contentDocument;"




document.body.appendChild(iframe);
iframeDocument = iframe.contentDocument;

// START PATCH

// Fix for iOS < 5.0
if(Ext.os.is.iOS && !Ext.os.is.iOS5) {
iframeDocument.open();
iframeDocument.writeln('</body>');
iframeDocument.close();
}

// END PATCH

this.testElement = testElement = iframeDocument.createElement('div');
testElement.style.position = 'absolute !important';


Done :-)

Hope it helps someone...

YOU ROCK MAN. I WILL TEST THIS LATER THIS WEEK

Evantan
18 Nov 2011, 11:10 PM
Found a fix !

Patch your sencha-touch-all-debug-w-comments.js :

- at line 45212, after "iframeDocument = iframe.contentDocument;"




document.body.appendChild(iframe);
iframeDocument = iframe.contentDocument;

// START PATCH

// Fix for iOS < 5.0
if(Ext.os.is.iOS && !Ext.os.is.iOS5) {
iframeDocument.open();
iframeDocument.writeln('</body>');
iframeDocument.close();
}

// END PATCH

this.testElement = testElement = iframeDocument.createElement('div');
testElement.style.position = 'absolute !important';


Done :-)

Hope it helps someone...

Confirm this bug and confirm this fantastic quick fix in ST2.0pr2, just save my life...
Anyway, a 'null' body in iframe.contentDocument is weird, is it due to gap bridge iframe or some what in phonegap? Phonegap itself use a iframe on page, but it seems not use iframe's body at all...
Anything use animations break, including nestedlist.Hope official fix come out soon.

dellerbie
29 Nov 2011, 6:09 PM
Good find. I was curious how you was able to track down the line that was causing the crash? Debugging in Xcode with PhoneGap is a nightmare, I didn't get any errors in my console even though the app was obviously crashing.

olouvignes
30 Nov 2011, 3:11 PM
I used Weinre as a console, and started to add logging breakpoints in ST core... Took some time but i finally isolated the crashing class/function/line...

Native debugging is painful... !