21

I am using xCode 4.3.1 and as soon I want to use lldb, I hardly get any debug information but get the following result instead, po-ing on a simple NSMutableDictionary property:

(lldb) po _keywordCache
error: instance method 'delegate' has incompatible result types in different translation units ('objc_object *' vs. 'id')
error: instance method 'delegate' has incompatible result types in different translation units ('objc_object *' vs. 'id')
note: instance method 'delegate' also declared here
note: declared here with type 'id'
note: instance method 'delegate' also declared here
note: declared here with type 'id'
error: 2 errors parsing expression

Switching to gdb always gives proper results.
Anyone an idea?

user3929962
  • 517
  • 3
  • 6
  • 23
Koen
  • 1,092
  • 9
  • 11
  • 4
    No suggestions yet, but I just want to add that I have the same issue. – danielpunkass Apr 19 '12 at 14:48
  • 1
    I am currently seeing this with Xcode 5.1.1 when I type `expr tableView.translatesAutoresizingMaskIntoConstraints` in the debugger: it says `error: instance method 'undoManager' has incompatible result types ...` – Drux Jul 07 '14 at 06:36

4 Answers4

8

The source of the problem in my case was that the property in question here, "delegate" is declared as a subtly different type in the instance variable and the property declaration. In my case, the instance variable type was id and the property declaration was id<SomeProtocol>.

I'm going to report this as a bug to Apple, as it shouldn't cause failure to inspect variables. The fix is to make sure that the instance variable and the property declaration describe "delegate" as exactly the same type. Hope this helps!

Steve Madsen
  • 13,465
  • 4
  • 49
  • 67
danielpunkass
  • 17,527
  • 4
  • 24
  • 38
  • Do you have a open radar I can dupe? This has been bugging me as well. – Ben Scheirman Apr 20 '12 at 19:51
  • Hi Ben - I ended up not reporting this because in my tests with the latest tools on Mountain Lion, it appears to be fixed. – danielpunkass Apr 26 '12 at 18:13
  • I am seeing this right now with the latest mountain lion and Xcode. It's in RestKit when (e.g.) a property is ailased to an id iVar but the property is an NSObject* – Rog Jun 08 '12 at 15:17
1

I know this is late, but ran into this on Xcode 6, needed to do a Clean Build Folder (hold down option while selecting clean).

migs647
  • 847
  • 6
  • 8
1

I have the same problem in Xcode 7.3 (7D1002) since yesterday. Before it worked fine for weeks. In my case now even a simple "po someString" doesn't work:
    error: instance method 'URLEncodedString' has incompatible result types in different translation units ('void *' vs. 'NSString *')
    error: instance method 'URLDecodedString' has incompatible result types in different translation units ('void *' vs. 'NSString *')
    note: instance method 'URLEncodedString' also declared here
    note: instance method 'URLDecodedString' also declared here
    error: 2 errors parsing expression

Things I tried:

  • quit and relaunch Xcode7 and the simulator (they were both running since several days without relaunch)
  • Xcode:Product->Clean and (holding the option key) Clean build folder
  • Delete ~/Library/Preferences/com.apple.dt.Xcode.plist
  • Delete ~/Library/Developer/Xcode/DerivedData/*
  • Delete ~/Library/Developer/Xcode/iOS DeviceSupport/*
  • Install the latest OS X El Capitan Update 10.11.4

but all that didn’t help. Still can neither p nor po strings in the debugger.

I still have an old Xcode 6 on my Mac (renamed and put away before installation of Xcode 7, then put back in /Applications). And that still works, I can enter “po someString” in the debugger and it prints the string into the debug log. But Xcode 7 doesn´t…

I found a workaround for local variables (even though this problem is different) here:
http://lists.apple.com/archives/xcode-users/2014/May/msg00088.html
ctrl-click on variable in local variables list and choose “print description”
    Printing description of someString:
    ipad

which helps a little but cannot print more complex commands.

user8030
  • 123
  • 4
-1

I also had that error, for me it actually had nothing wrong with the code though. All i did was click the button on the right of the "Toggle global breakpoint state" button in the console.

It is the blue arrow shaped button.
It is the blue, arrow-shaped button.

Mundi
  • 79,884
  • 17
  • 117
  • 140
user3597140
  • 39
  • 1
  • 6