4

I'm getting an error when I try to build my MacOS app in Xcode.

Command MergeSwiftModule failed with a nonzero exit code.

error: umbrella for module 'PDFKit' already covers this directory
        umbrella header "PDFKit.h"
                        ^
error: inferred submodules require a module with an umbrella
        module * { export * }

Most of my Swift files have:

import Cocoa
import Quartz

I'm using PDFKit a lot, so I'm guessing it's something to do with importing and referencing the headers. The error occurs on Xcode 11.1 and 11.2.

I have tried a Clean Build, without success. There are other threads about this, such as this one, which seem to suggest that it's a non-specific, intermittent problem.

3
  • Do you #import <PDFKit/PDFKit.h> in code? You got this error because the Quartz framework umbrella header already has PDFKIt import. Commented Apr 1, 2020 at 10:28
  • I'm using Swift, so I just used the import Quartz statements as above. Note that after removing the import commands and then restoring them exactly as before, the problem fixed itself. Commented Apr 1, 2020 at 10:32
  • I am able to fix this by replacing PDFKit import by Quartz and deleted PDFKit.framework from the build phase. Commented Apr 1, 2020 at 10:34

2 Answers 2

3

In my case, the compilation error was due to the import of a custom framework that in turns imported PDFKit. I changed the import PDFKit in the framework code with import Quartz, and that workaround solved the problem in Xcode 11.6.

Xcode 12 beta 3 seems to work better and does not require any workaround to build the existing code.

Sign up to request clarification or add additional context in comments.

Comments

1

Because of the nature of the error messages, I deleted all the import Quartz statements from all the files, then tried to Build. Obviously, it then failed because of unknown objects.

Then, I restored the import Quartz lines, and the problem was fixed.

This does seem to be a bug in Xcode.

2 Comments

If you are using interoperability in your swift project, ensure you replace any #import <PDFKit/PDFKit.h> with the appropriate replacement #import <Quartz/Quartz.h>.
I think we're all already Quartz over PDFKit that, aren't we? But I'm not sure I know what 'using interoperability' is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.