- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我曾看到提到 description 和 debugDescription 用于调试目的,但还没有看到关于何时使用它们以及在什么条件下它们可能产生不同结果的精确解释。
NSObject 的文档也没有任何关于 debugDescription 的内容。问题:什么时候使用 which,在什么条件下,它们的输出应该/会不同吗?
最佳答案
Note: print-object actually calls the debugDescription method of the specified object. NSObject implements this method by calling through to the description method. Thus, by default, an object's debug description is the same as its description. However, you can override debugDescription if you want to decouple these; many Cocoa objects do this.
如果您实现了debugDescription
,在GDB 中打印对象将显示其结果。知道 description
在 UI 中使用(我知道绑定(bind)会那样做),您可能想使用它来打印一些用户不需要看到的附加信息。
关于objective-c - NSObject 描述和 debugDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9379633/
我曾看到提到 description 和 debugDescription 用于调试目的,但还没有看到关于何时使用它们以及在什么条件下它们可能产生不同结果的精确解释。 NSObject 的文档也没有任
在 Xcode 调试器中显示 NSDate 对象的值时,我试图覆盖 debugDescription 属性。 我的扩展代码: import Foundation extension NSDate {
我正在尝试为 Swift 类编写自己的调试描述。我的代码如下所示: class SceneData : DebugPrintable { var fileName : String v
Swift 文档说 debugDescription = A textual representation of self, suitable for debugging description =
我使用 GCD 在 SQL 数据库上执行大量数据提交和数据读取操作,我创建了串行队列并使用 dispatch_async 执行操作。 队列创建代码: self.dataBaseQueue = di
我最近开始通过添加一些自动化测试来扩展我的项目的测试功能。到目前为止,我已经在我的应用程序中编写了一些测试,直到我在我的应用程序中找到一个特定的功能。导航到 View Controller 后,我在页
我想将一个在线 json 文件加载到我的应用程序中,但我遇到了这个错误: typeMismatch(Swift.Array, Swift.DecodingError.Context(codingPat
在 Objective-C 中,您可以将名为 -debugDescription 的方法添加到返回字符串的类中。 Xcode 调试器将调用此方法以在调试器中显示类的值。在 C++ 中是否有与此等效的内
现在我正面临这个错误 Value of type '[UserOrderHistory]' has no member 'orderlist' 我的 JSON: { "OrderList": [
我是一名优秀的程序员,十分优秀!