lldb error: reference to 'foo' is ambiguous

I'm trying to po an object in lldb and I get the following:


(lldb) po foo

error: reference to 'foo' is ambiguous

candidate found by name lookup is 'foo'

candidate found by name lookup is 'foo'


I have seen references to this error back in Xcode 4.x but nothing recent. Is there a fix for this? I'm using Xcode Version 9.2 (9C40b) and ObjC.

Replies

Upon further review it only seems to happen on static pointers. Instance variables seem to po just fine.

Did you find any solution for this issue?

I do not know how is your foo but sometimes the Swift compiler need a bit of help, if you define the return value, it should work.


I mean, for instance:


Consider this examples:


1. Example:


Error: Type of expression is ambiguous without more context


let values = ["text":inputTextField.text!,"toId":toId,"fromId":fromId, "timestamp":timestamp]


To solve it:


let values : [String : Any] = ["text":inputTextField.text!,"toId":toId,"fromId":fromId, "timestamp":timestamp]


or also:


let values = ["text": inputTextField.text!, "toID": toId, "fromID" : fromId, "timeStamp" : timestamp] as [String : Any]


2. Example:


Error: Ambiguous reference to member 'post(_:at:use:)'


    router.post("test") { req in
        print("test")
        return "test"
    }


To solve it:


router.post("test") { req -> String in
  print("test")
  return "test"  
}


I hope this answer will be helpfull for you.