Error while Debugging at breakpoint


While trying to debug (using p / po) at a breakpoint on Xcode, I get the following error:

I am trying to print the input parameters to the function.

func f1(p1: Set<CKRecord>,
        p2: Set<CKRecordID>,
        context: NSManagedObjectContext?) {
    guard let context = context,
        let containerName = containerName else { //containerName is an enum iVar
    //more code
    print("aaa") //Breakpoint is over here.

Error 1:
Couldn't apply expression side effects : couldn't get the data for variable containerName

Error 2: (sometimes I get the following error)
error: <EXPR>:3:1: error: use of unresolved identifier 'containerName'

However the side panel (on the left) with the variable names contains detail, again when I right click to print it throws the same error on the console.

Attempts made:
I have tried both po and p

Build configuration is Debug

Is this with a recent snapshot or with the toolchain that came with your Xcode? If the later, can you try a recent 4.2 snapshot from ?

The “unresolved identifier” error is the bane of my Swift experience. Happens a lot in closures, even if the variable is visible in the UI. I’ve found that frame variable will print it even if po won’t.


I am using Swift 4.1 with Xcode (from App Store)

Thanks frame variable seems to work, I didn’t know about it.