如何防止iOS独立网络应用锁定设备? [英] How can I prevent iOS standalone web apps from locking up the device?

查看:78
本文介绍了如何防止iOS独立网络应用锁定设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的原型服务创建了独立的,不可移植的iOS Web应用程序.有时他们会在使用时锁定设备.

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

主页按钮停止工作,该应用程序继续工作.在设备的控制台中反复显示以下内容(通过附加到xcode来获取).

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.

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

推荐答案

由于其原因仍然未知,我想我将通过告诉您在IOS上遇到与HTML5应用完全相同的问题做出贡献iPhone 4s为6.在我的情况下,该应用程序无法锁定(仍然可以使用),但是主页按钮停止工作(完全像您和Jens一样).时间是随机的,似乎与我能够一致地复制它的方法无关.同样,即使发生这种情况,即使设备实际处于横向(在iPhone上),window.orientation也会始终错误地报告纵向模式.

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).

更新12/15/2013
1)检测此错误:当iPhone发生错误时,我已经能够捕获到该错误.我的应用程序在横向模式下工作,通常它们可以随时翻转为横向模式.但是要捕获此错误,它现在可以检测该应用程序是否在iPhone上运行,并抛出一个包版页面,该页面要求用户将其设备旋转到横向才能启动.在这段时间内,应用程序会查看陀螺仪是否指示设备正确处于横向模式,但是windows.orientation(错误)表示它处于纵向模式.只有在触发错误时才会发生这种情况.因此,然后我可以显示一条好消息,告诉用户如何恢复.注意:此方法仅适用于iPhone ...我还没有找到在iPad上检测到该问题的解决方案.

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)避免出现此错误:我找到了一种避免发生此问题的方法(需要一些额外的工作).我注意到,在清理事件处理程序的工作方式后,问题只会在应用程序的后续加载中发生,而并非在我第一次加载时出现.而且我还注意到,关闭该应用程序后,它仍在iOS任务列表"中运行(不确定适用于此的iOS术语是什么).

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.

这篇关于如何防止iOS独立网络应用锁定设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆