środa, 14 listopada 2012

GWT apps still crashes on iOS 6.1 Safari Mobile (10B5105c)

Unfortunately, iOS 6.1 has not brought a solution to the problem of GWT applications running on Safari Mobile.
This is related to the
ClassCastException issue described in the previous article.
Tests done on iOS 6.1 simulator (available from XCode 4.6 Developer Preview). On the
OS X version of Safari (6.0.2) the problem doesn't occur.

It is very possible the problem applies to all applications based on AJAX / HTML5 not only GWT.

It is interesting that when the iPad simulator 6.1 (as well as "physical" iPad 6.0.1) is connected to the Remote Web Inspector - all the problems disappear. This may mean that the cause is the optimizer used iOS6 Mobile Safari.

Solution: Compile the application with the -XdisableCastChecking gives a positive result, but I'm afraid other surprises with the new Safari Mobile.

Has anyone experienced similar problems and found a different solution?

poniedziałek, 12 listopada 2012

GWT WebApp and iOS 6 Safari ClassCastException problem + solution

There are many kind of troubles with new iOS 6. I meet some with Google Web Toolkit app.
With Safari 6 on OS X everything is working good. Also on the iPad with iOS 5 is well. Troubles began after upgrading to iOS 6 (10A403). The problem is ClassCastException.

It can be thrown occasionally in different places while app is initializing. For example it happens while iterating collection of String with foreach. Another time, when adding an item to the collection  using put or putAll, it means Map<String, V> passed to collection.putAll(newValues). The exception is thrown by java.util.HashMap.

The strangest thing is that connecting the iPad to Mac and running the Remote Web Inspector makes problems disappear. Also compiling application with compiler.stackMode set to emulated, hides all the problems. So I debugged it with using simple Window.alert messages.

I believe iOS 6.1 will be fixed (but for now upgrade to 6.0.1 brings no changes).

If somebody has simillar problems, there is a temporary solution. You can compile application with -XdisableCastChecking. If you use this option in your application, it might help.
This option can have a significant positive impact on performance, but it should be used in production mode only.
Unfortunatelly it's not the only problem with new iOS...