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

前端 未结 2 1249
面向向阳花
面向向阳花 2021-02-04 11:40

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

相关标签:
2条回答
  • 2021-02-04 12:21

    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.

    0 讨论(0)
  • 2021-02-04 12:23

    The SoundJS team has tracked this issue down to the web app entering full screen mode using:

    <meta name="apple-mobile-web-app-capable" content="yes" />

    A bug was reported to apple (reference #15133492).

    Currently we have no work around except not entering full screen mode.

    0 讨论(0)
提交回复
热议问题