简体   繁体   English

优雅地崩溃iOS Cordova应用

[英]Crash ios cordova app gracefully

This might sound odd but I want to get my app to crash gracefully. 这听起来可能很奇怪,但我想让我的应用正常崩溃。

Since there is no way in cordova to actually close the app via API this seems to be the only solution, well at least in my mind. 由于cordova无法通过API实际关闭应用程序,因此这似乎是唯一的解决方案,至少在我看来是这样。

So my question how can I crash my cordova app without an error dialog popping up? 所以我的问题是如何在不弹出错误对话框的情况下使我的cordova应用程序崩溃?

Or as an alternative: are there ways to close the app I don't know about? 或者作为替代方案:是否有办法关闭我不知道的应用程序?

It is considered against Apple policies to programmatically crash/close the app and is highly recommended not to do this. 按照Apple的政策,以编程方式将应用程序崩溃/关闭是违反的,强烈建议您不要这样做。 And Apple has rejected apps in the past, that don't adhere to this policy. 苹果过去拒绝了不遵守该政策的应用。

This is mentioned by Apple here , since an app that closes down albeit programmatically, gives user the illusion of a crash which is not a good user experience. 苹果在这里提到了这一点,因为尽管程序关闭了应用程序,但它会给用户带来崩溃的错觉,而这并不是良好的用户体验。

It goes on to say, 继续说,

If during development or testing it is necessary to terminate your application, the abort function, or assert macro is recommended. 如果在开发或测试期间有必要终止应用程序,则建议使用abort函数或assert宏。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM