0
votes

My app was crashing due to this error:

-[__NSCFDictionary length]: unrecognized selector sent to instance 0x178669400 2014-08-08 16:24:14.397 TestAPP[7196:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary length]: unrecognized selector sent to instance 0x178669400'

It wasn't part of the code. I tried adding breakpoint inside the viewcontroller.m file. I couldn't find the line that caused this bug. I added the symbolic breakpoint for [NSObject doesNotRecognizeSelector:]: Debug Navigator showed me issue in the UIVIEW layer. Any idea what could be wrong? I have added the screenshot of the debug navigator.

debug navigator view

Thread 1 stack is shown below: enter image description here

With the exception breakpoint I could see the following:

debug navigator

Here is the stack trace for the crash:

  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
 )
1
Try adding an exception breakpoint.Luca Bartoletti
That doesn't seem to helpSiddharthan Asokan
It should stop the execution at the line where you are calling length on a NSDictionary instance. Can you explain what is happening with the exception breakpoint?Luca Bartoletti
Most likely you have passed a dictionary as the text of a label.Hot Licks

1 Answers

4
votes

You're trying to get the length of a dictionary somewhere. My guess is you're trying to get the length of what you think is an NSString but is actually an NSDictionary.