Xcode Console "po" error: expression failed to parse - ios

My Xcode cannot po anything suddenly, such as:
po param
error: expression failed to parse:
error: Couldn't realize type of self.
Everytime I use "po" to print something in console, it will show the errors above. It happens one month ago.

I know this does not fix the problem, but meanwhile you can use v param to achieve the expected result.
https://stackoverflow.com/a/60064468/2347811

well, you could click right button and choose "print..." at console.

Related

Xcode po is not printing output in debugging area

Xcode is not giving expected results when i try to print any object. I am using Xcode 12.4 .. In another mac its working fine.
Ex: When i try to print the text inside the UITextField getting below
error
(lldb) po emailTextField.text
expression produced error: error:
/var/folders/5q/9vj8df5s0xs_2splf1fbwgzh0000gn/T/expr39-7ad9b9..swift:1:51:
error: cannot specialize a non-generic definition
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Optional<Swift.String>>(bitPattern:
0x10ba5a660)!.pointee)
^
/var/folders/5q/9vj8df5s0xs_2splf1fbwgzh0000gn/T/expr39-7ad9b9..swift:1:64:
note: while parsing this '<' as a type parameter bracket
Swift._DebuggerSupport.stringForPrintObject(Swift.UnsafePointer<Swift.Optional<Swift.String>>(bitPattern:
0x10ba5a660)!.pointee)
^
(lldb)
I have tried all the options given in the App Dev answers and tried changing the xcode, still no luck
Spammers stay and Don't spam with your unrelated answers

Xcode debugger not printing variables in some files

I have an issue with the Xcode debugger. Everything works fine in general, I can print variables using po <var> normally... Except in some files, where I can't print anything, and I have a error: Couldn't apply expression side effects : couldn't get the data for variable self
error in the console.
Weirdly, Xcode shows values correctly on the left debugger panel.
Does anyone have an idea?
Thanks!
Similar observations, all good on the left panel but printing ends with the same message. Quick improvement was to use:
po print(variable)
or
po debugPrint(variable)
Result - prints variable and appends the same error message.

Clunky lldb error while printing variables in XCode's debugger console

Lately I've got problem to print any kind of variable into XCode's debugger console. It doesn't matter which platform I'm building against. I've tried to reinstall whole XCode, command line tools + cleaned/removed the derived data of swift project I'm working on. None of these steps solved my issue, this error prevent me from using XCode for 100%.
Everytime I'm trying to print something I've got this error in debug console.
Printing description of X:
expression produced error: /var/folders/4y/mm1fk7rn5c57ct91syb3ndf40000gn/T/lldb/6651/expr11.swift:1:1:
error: cannot convert value of type 'Int' to expected argument type 'random type'
$__lldb__DumpForDebugger(Swift.UnsafePointer<Swift.Bool>(bitPattern: 0x104c5ced0).memory)
^~~~~~~~~~~~~~~~~~~~~~~~
<EXPR>:18:7: error: cannot convert value of type 'Int' to expected argument type 'random type'
if (1==1) {
where random type can be any type of class/type.
Have anybody came across the same problem lately? Seems like lldb is bit broken when it comes down to print values of swift variables.
I'm using XCode 7.3.1 (7D1014) with latest update of Mac OS X.

Debugging with Swift & Xcode 6.4?

Why po returns these strange errors? (with Xcode 6.4 & Swift)
I try to debug with p / po:
NSDictionary, String and NSNumber all getting similar kind of errors all the time.
For now, I use println() but I am curious what could be the reason?
error: A fatal parse error has occurred. LLDB may become unstable; please restart your debug session as soon as possible.
error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {
^~~~~~~~~~~~~~~
<EXPR>:11:5: error: use of unresolved identifier '$__lldb_injected_self'
$__lldb_injected_self.$__lldb_wrapped_expr_7(
^
For swift language use println() method.For debugging in console you have to keep in mind that you can only get debug info for swift's variables, but can't get it for swift's constants. So change let someVariable to var someVariable.
then in debugger do po someVarible. It will work.
If it doesn't work for arrays & dictionary ,for arrays do something like po print(myArray). Same goes for dictionary.

Compiler error with no line number

Whwn trying to compile my project, the following error appears in AppCode (Xcode only prints the "Error: Command... part"):
AppCode:
Note:Stored value type does not match pointer operand type!
Note: store %CSo7UIColor* %135, %objc_object** %136, align 8, !dbg !4686
Error: %objc_object*LLVM ERROR: Broken function found, compilation aborted!
Error:Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
Is there a way to actually get the line number causing the problem ? Note says something related to UIColor but that's the only thing I got from it :S
P.S: I have deleted Derived Data, checked out a previous commit, created a new project and still the same issue. I'm almost certain that the problem is due to a dependency.
Found the problem...
self.navigationController!.navigationBar.titleTextAttributes = [ NSForegroundColorAttributeName : .clearColor()]
.clearColor() should work...Fixed it by appending UIColor back.

Resources