一个地方可以捕捉到钛的所有突然异常? [英] one place to catch all sudden exceptions in titanium?

查看:27
本文介绍了一个地方可以捕捉到钛的所有突然异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Titanium Android 应用程序开发的新手,并且在使用我的应用程序期间遇到了网络关闭"的令人不快的情况.我尝试在我的模拟器上重现它,但在应用程序仍在工作时进入飞行模式".

I am new to Titanium Android App development and going through an unpleasant scenario of "Network goes off" during use of my app. I tried reproducing it on my emulator, but going "Airplane mode" while app still working.

我在 app.js 中尝试了以下内容:

I tried below in app.js:

Ti.App.addEventListener('uncaughtException',function(){
alert("caught"); });  

Ti.App.addEventListener('TiException',function(){
alert("caught:Ti"); });

好消息是我能够看到被捕获",但在我的应用程序看到红色屏幕细节并且它坏了之前.看图片:应用崩溃错误

So good thing is I am able to see "caught" but not before my app sees a red screen detailing and it breaks. see image: App crash error

如果有人可以帮助我确定如何捕获所有那些计划外"异常并根据某些业务逻辑引导它们,以便用户看不到这些爆炸,那将非常有帮助.

it would be very helpful if someone can help me out in identifying how to catch all those 'unplanned' exceptions and direct them as per some business logic so that user doesnot see those blasts.

提前致谢

推荐答案

您看到的异常与 LiveView 相关.请参阅此处的文档:http://docs.appcelerator.com/platform/latest/#!/guide/LiveView 与应用程序上的代码完全无关.

The exception that you are seeing is related to LiveView. See the docs here: http://docs.appcelerator.com/platform/latest/#!/guide/LiveView which is totally unrelated to the code on the app.

如果您要在您的应用中测试离线模式,您需要在没有 LiveView 的情况下运行它,因为它需要连接才能工作.

If you are going to test offline mode in your app you need to run it without LiveView because it requires connectivity to work.

供参考:

捕获所有异常的事件是未捕获异常

TiException 不是有效事件,因此永远不会触发.

TiException is not a valid event so it will never be triggered.

这篇关于一个地方可以捕捉到钛的所有突然异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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