facebook/chisel

Visualize doesn't work in Swift

Closed this issue · 8 comments

Visualize is only working in objective-c when you try to visualize something in Swift you get the next error:

`
(lldb) visualize image

error: error: use of undeclared identifier 'image'
error: 1 errors parsing expression
Traceback (most recent call last):
File "/usr/local/opt/chisel/libexec/fblldb.py", line 83, in runCommand
command.run(args, options)
File "/usr/local/Cellar/chisel/1.5.0/libexec/commands/FBVisualizationCommands.py", line 183, in run
_visualize(arguments[0])
File "/usr/local/Cellar/chisel/1.5.0/libexec/commands/FBVisualizationCommands.py", line 151, in _visualize
if fb.evaluateBooleanExpression('(unsigned long)CFGetTypeID((CFTypeRef)' + target + ') == (unsigned long)CGImageGetTypeID()'):
File "/usr/local/opt/chisel/libexec/fblldbbase.py", line 84, in evaluateBooleanExpression
return (int(evaluateIntegerExpression('(BOOL)(' + expression + ')', printErrors)) != 0)
File "/usr/local/opt/chisel/libexec/fblldbbase.py", line 76, in evaluateIntegerExpression
output = evaluateExpression('(int)(' + expression + ')', printErrors).replace(''', '')
AttributeError: 'NoneType' object has no attribute 'replace'
`

Swift:
screen shot 2016-12-01 at 12 23 19 pm

Objective C: no error
screen shot 2016-12-01 at 12 22 30 pm

Thanks for the report. I think I know what the cause may be and will try to get a fix soon.

Hello guys I would like to know if have you fixed this issue ?

I haven't fixed it, there's a work around you could try: add backticks (backquotes). For example:

visualize `image`

still not work?

@brandFromNSK did you try the work around?

visualize `variable`

I tried backticks around the variable (a UIImage) and it did not work. Still seeing errors (Chisel 1.5.0).

@kastiglione @brandFromNSK I tried workaround and it works in [swift 4|Xcode 9 Beta|Chisel 1.5.0]. But I suggest update README or help command to let everyone know.

This is fixed in #244