Debugging Issues When Integrating PSPDFKit

After integrating PSPDFKit, you might see the error error: Couldn’t IRGen expression, no additional error when using lldb with p, po, or expr.

This is an issue in lldb, which happens when you’re trying to integrate PSPDFKit in a Swift-only project.

A workaround for this issue is to add Objective-C files and a bridging header to your project, like what’s mentioned in this Stack Overflow post.

Currently, there’s a hard requirement that the version of the Swift compiler that builds source files and the version of lldb used to debug must come from the same toolchain.

The underlying issue here is caused because lldb isn’t able to build a Swift context for expression evaluation (including variable inspection) without importing the full tree of module dependencies.

We also reported this via FB7718242.

As a workaround, you can delete the PSPDFKit dSYMs (PSPDFKit-dSYMs and PSPDFKitUI-dSYMs) from all Spotlight-indexable locations or your drive.


This workaround won’t work on projects that integrate via CocoaPods, because CocoaPods automatically downloads and handles dSYMs.

For more details, take a look at @steipete’s How to Fix LLDB: Couldn’t IRGen Expression blog post.