Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent iOS standalone web apps from locking up the device?

My prototyping service creates standalone, isntallable iOS web apps. Sometimes they lock up the device while in use.

The home button stops working, the app continues to work. The following is shown repeatedly in the device's console (retrived by attaching to xcode).

Apr 25 14:34:57 SpringBoard[67] <Warning>: Unable to determine intended instance of com.apple.webapp. Resulting app will be undefined.

like image 834
Nathan Manousos Avatar asked Apr 25 '13 22:04

Nathan Manousos


1 Answers

Since the cause of this is still unknown, I thought I'd contribute by telling you that I'm getting the exact same problem with an HTML5 app on IOS 6 with iPhone 4s. In my case the app does not lock up (still works) but home button stops working (exactly like you and Jens). The timing is random, and does not seem to be tied to anything I can do to replicate it consistently. Also when it happens, window.orientation always incorrectly reports portrait mode, even when device is physically in landscape (on the iPhone).

UPDATE 12/15/2013
1) Detecing this bug: I've been able to trap when the error occurs on the iPhone. My app works in landscape mode, and normally they can flip to landscape at any time. But to trap this bug, it now detects if the app is running on iPhone and throws up a roadblock page that requires the user to rotate their device to landscape to start. During this time the app looks to see if the gyroscope indicates the device is correctly in landscape mode, but windows.orientation (incorrectly) says it's in portrait. That only happens when the bug is triggered. So, then I can show a nice message telling the user how to recover. Note: this method only works on the iPhone... I haven't yet figured out a solution to detect it on the iPad.

2) Avoiding this bug: I found one way to avoid the problem from occurring (with a little extra work). I've noticed that after cleaning up the way my event handlers work, the problem only occurs on subsequent loads of the app…not the very 1st time I load it. And I also noticed that after closing the app, it's still running in the iOS "task list" (not sure what the proper iOS term for this is).

So double press the home button to bring up the task list and swipe it away (to truly close it). I've never had the problem recur after following this. Additional note: simply doing a reboot of the device is not enough (and seems to still result in hangs). And after a reboot, I've noticed it will be in the task list twice (which seems wrong and perhaps a clue on what's going wrong internally). Anyway, if you rebooted, before starting the app, make sure you go to the task list and remove all instances of the app first.

like image 86
Ian Ippolito Avatar answered Oct 05 '22 23:10

Ian Ippolito