Debugging Issues when integrating PSPDFKit

Q: I see the error error: Couldn't IRGen expression, no additional error when using lldb with p, po, or expr after integrating PSPDFKit.

A: This is an issue in lldb, which happens when you are 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 mentioned in this StackOverflow post.

Currently there is 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 because lldb is not able to build a Swift context for expression evaluation (including variable inspection) without importing the full tree of module dependencies.

We also opened a feedback via FB7718242.

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

Note: This workaround will not 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.