Alexander Stepanishin
Alexander Stepanishin

Reputation: 494

How to import project and print casted swift objects in xcode debugger (lldb)

I have attached debugger to running app. Now I'm trying to print casted Swift object in lldb console using these commands:

expr -l Swift -- import MyProjectName
expr -l Swift --  let $vc = unsafeBitCast(0x3daf26c078d8, ViewController.self)
expr -l Swift -- print($vc.view)

But I'm getting error: no such module 'MyProjectName' on 1st line. Project name is matching with .xcodeproj and .xcworkspace files. Any thoughts on how to fix this?

Upvotes: 4

Views: 225

Answers (1)

Denis
Denis

Reputation: 1

You need a UIView of a UIViewController, don't you ? So you can basically import UIKit in place of the whole app.

expr -l Swift -- import UIKit
expr -l Swift --  let $vc = unsafeBitCast(0x3daf26c078d8, UIViewController.self)
expr -l Swift -- print($vc.view)

Upvotes: 0

Related Questions