简体   繁体   English

xcode for iOS中的异常断点是可以原谅的例外吗?

[英]Exception breakpoints in xcode for iOS, is exceptions excusable?

Am new to the iOS development. 我是iOS开发的新手。 While looking into one of the App I work on, with exception breakpoint enabled in xcode . 在查看我正在使用的App之一时,在xcode启用了exception breakpoint I see so many repetitive exceptions been raised. 我看到有很多重复的例外被提出来了。

But till now, we never realised this, as iOS was excusing those exceptions. 但是到现在为止,我们从来没有意识到这一点,因为iOS开脱这些例外。 The main exception was happening in our service layer, where, in an XML parsing, one of the element mentioned as key was missing. 主要的例外是在我们的服务层中发生,在XML解析中,缺少一个提到的密钥元素。 since so many back end requests are fired, for every XML response, and for multiple items inside it, this exception is thrown. 由于触发了如此多的后端请求,对于每个XML响应以及其中的多个项,都抛出此异常。

Now that our app is published, will this impact the device's stability? 现在我们的应用程序已发布,这是否会影响设备的稳定性? We are planning to fix thee kind of issues. 我们正计划解决这类问题。 But now, Will these be logged into Apple's diagnostic information. 但现在,这些是否会记录在Apple的diagnostic信息中。 Just curious to know these. 只是很想知道这些。 Can someone shed some light over it? 有人可以对此有所了解吗?

In Objective-C, Exceptions are used to signal fatal errors, that is programmer errors and "unexpected" and unrecoverable runtime errors. 在Objective-C中,异常用于表示致命错误,即程序员错误和“意外”以及不可恢复的运行时错误。 In Objective-C, Exceptions are a debugging and testing aid, not a construct to control program flow or to regain control after an error. 在Objective-C中,异常是一种调试和测试辅助工具,不是控制程序流程或在发生错误后重新获得控制的构造。

Usually, an application in a release state shouldn't throw exceptions. 通常,处于发布状态的应用程序不应抛出异常。 If it happens anyway, the only correct course of action is to terminate the program as soon as possible. 如果它发生了,唯一正确的做法是尽快终止程序。 In general, the Objective-C system frameworks are not exception safe . 通常,Objective-C系统框架不是例外安全的 This means, after an exception has been thrown the application's state will be corrupt. 这意味着,在抛出异常后,应用程序的状态将会损坏。 If your program continues, even worse things may happen. 如果您的计划继续下去,可能会发生更糟糕的事情

There are only a few, always undocumented harmless cases where exceptions will be thrown and caught by system libraries without leaving the program in an unstable condition. 只有少数几个总是没有文档记录的无害案例,系统库会抛出异常并且不会使程序处于不稳定状态。

See also https://developer.apple.com/library/ios/documentation/cocoa/conceptual/Exceptions/Exceptions.html 另请参阅https://developer.apple.com/library/ios/documentation/cocoa/conceptual/Exceptions/Exceptions.html

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

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