Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sencha touch/cordova app randomly crashes on startup in ios8

My app is written with sencha touch 2.4 and uses the latest version of cordova. Since iOS8 I have an issue with the app randomly crashing. It only happens if I completely close the app, and only sometimes. The crash appears to happen directly after the splash screen is shown. The sencha touch loading icons do not appear and the app simply closes. If I try to open the app again, it works.

I use localstorage pretty much immediately to populate username and such, I tried to remove it since I read it caused problems but it did not help.

Edit: After more investigation I now get this error:

[UIViewAnimationState release]: message sent to deallocated instance 0x17675080

It appears on a completely new cordova/sencha touch example project, and with iOS8. Any idea what the cause of this can be? Are there any tips to how I can debug this issue?

Edit2: Sencha says that they will not support ios8 officially before next release, 2.4.1. http://www.sencha.com/forum/showthread.php?292883-Touch-2.4.0-apps-crashing-on-iOS8

Edit3: I think I was able to improve this by following the advice in the forum-thread linked aboved. I updated sencha touch, sencha cmd and cordova to the latest version and installed the splashscreen-plugin for cordova. I have not had a startup crash since, hopefully this has fixed the issue.

like image 854
Jarle Hansen Avatar asked Oct 03 '14 06:10

Jarle Hansen


1 Answers

Edit 24/03/2015

We have found this plugin https://github.com/Telerik-Verified-Plugins/WKWebView which fixes the random crashes using the new WKWebView instead of the old UIWebView.


This seems not directly related to Sencha Touch and or Cordova, as this bug report on Xamarin proves.

Xamarin is a .NET framework to build native mobile apps, so this means it's not a Cordova/Phonegap bug, additionally the bug reporter reproduced the bug loading http://www.xamarin.com web page into the WebView and this proves it's not a Sencha Touch bug. He states that "it seems more likely a JavaScriptCore bug".

The poster of the bug report set up some tests with an external web page, with jQuery Mobile app and with Sencha Touch finding that the different pages made the application crash with different rates, in particular the very simple jQuery Mobile application was the more stable of the three.

So I tried to remove all the external libraries from my Sencha application app.json (it used to depend on Chart.js, jQuery, and some other libraries) and I noticed that without including them the application had become much more stable.

I rewrote the parts of code that needed those libraries, reimplementing the features in plain Javascript and I made some tests, finding out that while with the external libraries loaded it crashed 1/2 of the times, the lighter version crashed about 1/50 of the times (these statistics have been acquired starting the app 50 times with each version).

These tests seem to suggest that the bug is related to the weight of the page being loaded onto the webview, the lighter the page is, the less likely it is to crash.

I hope this could help, at least improving the stability of your application until Apple fixes the WebView.

like image 66
Andrea Casaccia Avatar answered Oct 14 '22 19:10

Andrea Casaccia