【问题标题】:Symbolic Breakpoint for -[NSObject doesNotRecognizeSelector:]:-[NSObject doesNotRecognizeSelector:] 的符号断点:
【发布时间】:2023-03-26 10:57:02
【问题描述】:

我的应用由于这个错误而崩溃:

-[__NSCFDictionary 长度]:无法识别的选择器发送到实例 0x178669400 2014-08-08 16:24:14.397 TestAPP[7196:60b] *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[__NSCFDictionary 长度]:无法识别的选择器发送到实例 0x178669400”

它不是代码的一部分。我尝试在 viewcontroller.m 文件中添加断点。我找不到导致此错误的行。我为 [NSObject doesNotRecognizeSelector:] 添加了符号断点:Debug Navigator 在 UIVIEW 层中向我显示了问题。知道有什么问题吗?我添加了调试导航器的屏幕截图。

线程 1 堆栈如下所示:

使用异常断点,我可以看到以下内容:

这是崩溃的堆栈跟踪:

  CRASH: -[__NSCFDictionary length]: unrecognized selector sent to instance 0x17826aa00
  Application Memory Usage 46649344
  Device Orientation 5
  Total space 28096 Total Free Space 20312
  Stack Trace: (
      0   CoreFoundation                      0x000000018cd2711c <redacted> + 160
      1   libobjc.A.dylib                     0x00000001992301fc objc_exception_throw + 60
      2   CoreFoundation                      0x000000018cd2bdb4 <redacted> + 0
      3   CoreFoundation                      0x000000018cd29ae0 <redacted> + 912
      4   CoreFoundation                      0x000000018cc4978c _CF_forwarding_prep_0 + 92
      5   UIKit                               0x000000018fcfc0a4 <redacted> + 44
      6   UIKit                               0x000000018fd75b04 <redacted> + 112
      7   UIKit                               0x000000018fd75a34 <redacted> + 364
      8   QuartzCore                          0x000000018f90cf7c <redacted> + 140
      9   QuartzCore                          0x000000018f8f755c <redacted> + 2436
      10  QuartzCore                          0x000000018f8f6bc8 <redacted> + 112
      11  QuartzCore                          0x000000018f8f6758 <redacted> + 1260
      12  QuartzCore                          0x000000018f8d701c <redacted> + 244
      13  QuartzCore                          0x000000018f8d6ce4 <redacted> + 44
      14  QuartzCore                          0x000000018f8d6560 <redacted> + 280
      15  QuartzCore                          0x000000018f8d6304 <redacted> + 424
      16  UIKit                               0x000000018fcef154 <redacted> + 9800
      17  CoreFoundation                      0x000000018cce77f4 <redacted> + 24
      18  CoreFoundation                      0x000000018cce6b50 <redacted> + 256
      19  CoreFoundation                      0x000000018cce4de8 <redacted> + 632
      20  CoreFoundation                      0x000000018cc25dd0 CFRunLoopRunSpecific + 452
      21  GraphicsServices                    0x000000019290dc0c GSEventRunModal + 168
      22  UIKit                               0x000000018fd56fc4 UIApplicationMain + 1156
      23  PrototypeN                          0x000000010019af88 main + 116
      24  libdyld.dylib                       0x0000000199823aa0 <redacted> + 4
 )

【问题讨论】:

  • 尝试添加异常断点。
  • 这似乎没有帮助
  • 它应该在你调用 NSDictionary 实例的 length 的那一行停止执行。你能解释一下异常断点发生了什么吗?
  • 很可能您已将字典作为标签的text 传递。

标签: ios objective-c debugging


【解决方案1】:

您正试图在某处获取字典的长度。我的猜测是你试图得到你认为是 NSString 但实际上是 NSDictionary 的长度。

【讨论】:

  • 是的,很可能的情况是对某些 JSON 输入的处理不当。
  • 是的。这正是我的猜测。
猜你喜欢
  • 2011-03-04
  • 1970-01-01
  • 2016-11-30
  • 2013-10-19
  • 2017-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-06
相关资源
最近更新 更多