18

I have suddenly become unable to print out object properties or call methods inside of lldb. The only thing that prints out is:

error: class '<ClassName>' has incompatible superclasses
note: inherits from superclass 'NSObject' here

This is true for even the most basic object types, such as: NSArray, NSDictionary, and NSString. Here's a specific example:

(lldb) po functie.length
error: class 'NSString' has incompatible superclasses
note: inherits from superclass 'NSObject' here
error: 1 errors parsing expression

The only methods that are available are those available in NSObject, such as -class. Extending from the previous example:

(lldb) po [functie class]
__NSCFString

If anybody has any idea what the problem is, your input would be greatly appreciated. Thank you.

dudeman
  • 1,106
  • 8
  • 19
  • Is your build configuration Debug or Release? I've had weird errors like this because I was on Release. – NobodyNada Jun 04 '15 at 01:12
  • It's debug. I made sure to check. – dudeman Jun 04 '15 at 01:24
  • Did you clean and rebuild? Do you have this problem in other projects? – NobodyNada Jun 05 '15 at 01:02
  • If I were you, I would collect an expression log and file a bug on lldb. To collect the expression log type log enable lldb expr at the lldb prompt right before doing a po, and then attach the output to your bug report. – Enrico Granata Jun 05 '15 at 05:26
  • I did do a clean and a clean build folder. I just created a new project and the problem is not in the new project. So maybe it is isolated to my current project. It also seems that the problem is isolated to accessing apple's classes, and not my classes, because if I do `myClass.myProperty` I'm able to print out the property. And not only that, but the problem also seems to be isolated to building on a device (i.e. it does not occur in the simulator). – dudeman Jun 05 '15 at 16:09
  • 1
    I just did the expression log and it is very lengthy so I obviously won't post it here. I do, however, want to refrain from filing a bug report until I'm more certain the problem is with lldb and not something I did. I'll make sure to post on here if I do file a bug report and what the results of it are (if I get any). – dudeman Jun 05 '15 at 16:21
  • @dudeman Did you find the source of the problem? – ricardopereira Oct 17 '16 at 11:16
  • @ricardopereira Sorry, but no. The issue just disappeared one day. – dudeman Oct 17 '16 at 15:16

1 Answers1

10

Try this one:

  1. Select your project in the left project navigator.

  2. Switch to the Build Settings tab.

  3. Search for Debug Information Format.

  4. Set the value for Debug to DWARF.

  5. Clean Build Folder: hold Option + Command + Shift + K (That is ⌥ + ⌘ + ⇧ + K).

  6. Rebuild your project: ⌘ + R.

Good luck.

Lizhen Hu
  • 814
  • 10
  • 16
  • 5
    This worked for me. Then I switched back to DWARF with dSYM, did another clean, and the problem did not return. I suspect that my project file got a bit messed up when I opened the project in XCode 9 beta this morning. Burned by betas several times, but I apparently have not yet learned my lesson. :-) – dlw Sep 11 '17 at 13:33
  • This worked for me also and I too used an Xcode beta. Xcode 11 beta, so this is still an issue. – Mark Reid Jul 12 '19 at 13:56