Hey guys,
So I have this annoying problem, which I kind of think I know why it's happening, but I'm not sure, and of course, I don't know how to fix:
In my bridging header I have classes that import the `[name]-Swift.h` file and while everything works fine for building and testing, the moment I turn on Gather Code Coverage data, all the classes that also import `[name]-Swift.h` break and all of them report the "[name]-Swift.h file not found" error. These also appear in the logs:
Copy x86_64.swiftdoc / Copy [AppName]-Swift.h
ditto: can't get real path for source '/Users/roland/Library/Developer/Xcode/DerivedData
/Build/Intermediates/CodeCoverage/Debug/Intermediates/[AppName].build/Debug-iphonesimulator/[AppName].build/Objects-normal/x86_64/[AppName]-Swift.h / [AppName].swiftmodule'
Command /usr/bin/ditto failed with exit code 1
Generate dSYM file
error: cannot parse the debug map for "/Users/roland/Library/Developer/Xcode/DerivedData
/Build/Intermediates/CodeCoverage/Debug/Products/Debug-iphonesimulator/[AppName].app/[AppName]": No such file or directory
Copy x86_64.swiftmodule
ld: file not found: /Users/roland/Library/Developer/Xcode/DerivedData
/Build/Intermediates/CodeCoverage/Debug/Intermediates/[AppName].build/Debug-iphonesimulator/[AppName].build/Objects-normal/x86_64/[FileName].o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I read that at some point this kind of behavior was creating problems even when building, and I tried the following solutions, but none worked - importing the `[name]-Swift.h` last and creating an 'umbrella' [name]-Swift-Fixed.h` file, which only imports the real `[name]-Swift.h` file. Modules and testability are enabled, the project uses CocoaPods, but has properly set config files and `Build Active Architecture Only` is enabled.
Did anybody else encounter this? Is there any solution except rewriting the Objective-C files in Swift? 🙂
Cheers!