On 15 May 2014, at 12:54 PM, Owen Hartnett <email@hidden> wrote:
Often if I try to use po in ways that had usually worked fine in the past, I get something like:
clang/llvm has been getting stricter with every release; mostly a good idea, but sometimes a headache. I could guess why the context menu works from the variables list but not po * from the lldb command line, but it would be only a guess.
* (Pedantically, “_expression_ -O -- ” [hyphen-oh], but I’m OCD) po URLcomponentDict error: instance method 'safeObjectForKey:' has incompatible result types in different translation units ('NSDictionary *' vs. 'id')
Looked like the old have-to-typecast it, so I tried that:
po (NSDictionary *) URLcomponentDict error: instance method 'safeObjectForKey:' has incompatible result types in different translation units ('NSDictionary *' vs. 'id') note: instance method 'safeObjectForKey:' also declared here error: 1 errors parsing _expression_
Workaround: If I right click in the variables list, and choose Print Description, it does the right thing:
Printing description of URLcomponentDict: { callId = "5770b91e-d326-4d6d-b94b-e6847b5255b6"; callSubject = "incoming call from inPerson web portal"; callerName = "inPerson Web"; callerUserName = inPersonWeb;
messageType = "INPERSON.INCOMINGCALL";
Printing dictionaries always seemed to work fine with po, but not lately. Is there something I should be doing differently?
All dictionaries, or only the ones you’ve been trying recently?
I see that -safeObjectForKey: is from an external library. Are you importing it yourself, or getting it second-hand from another library?
Given that lldb (but why not clang?) objects to the declaration, which doesn't persist into the binary itself (it might into the .dSYM), try preprocessing your problem source file (Product > Perform Action > Preprocess “…”) and searching it for "safeObjectForKey". If you find the two declarations lldb complains about, you’re on your way to a solution.
Something else I’m curious about — do a “po [URLcomponentDict class]”. What class is it? The fact that po results in calling the “safe” access instead of the native one is curious. Perhaps someone has overridden -objectForKey: along the way?
— F
|