Will Haley
Will Haley

Reputation: 763

Why does exact copy of Xcode Build Configuration fail?

I have a react-native app with bridged Swift code that is building, running, and archiving without issue with Xcode 10.0 with the default Release and Debug build configurations. I use Xcode -> Product -> Archive or the "Play" button and everything works as expected. Great!

Then today I added a new build configuration that is an exact duplicate of Release. It is named Release copy. I did the same for Debug as well, and its duplicate is Debug copy.

screenshot of the xcode menu showing the process of duplicating the Release build configuration

If I try to run the same Archive or Run tasks using the copies, the tasks fail at Precompile bridging header.

/Users/whaley/dev/app/theApp/theApp-Bridging-Header.h:5:9: error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
        ^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/whaley/Library/Developer/Xcode/DerivedData/theApp-ckvpglaqydwzhadbbyqoprcjvnod/Build/Intermediates.noindex/ArchiveIntermediates/theApp/PrecompiledHeaders/theApp-Bridging-Header-swift_320079J7441HX-clang_QK5YQQC41WXA.pch' for bridging header '/Users/whaley/dev/theApp/ios/theApp-Bridging-Header.h'

Odd, in my opinion, since this should be an exact copy of a build configuration that was working fine.

If I switch back to the original Build Configurations everything is fine. The originals consistently work and the copies consistently fail.

I tried disabling the Precompile bridging header task, but just encountered a different, and similar error. Again, the original build configs worked where the copies failed.

I'm already using Find implicit dependencies, the bridging header is named properly, I'm not using Cocoapods, I've rebooted and cleared Xcode's Derived Data, and please bear in mind that it does work fine normally. It's only these duplicate build configurations that fail.

Why might this be happening? Am I missing a step here? Is this perhaps a limitation of react-native and it only supports the default build configs?

Upvotes: 5

Views: 1697

Answers (1)

Will Haley
Will Haley

Reputation: 763

Naturally, the moment I posted my question I managed to find the answer I needed via Google

Thanks to Mateusz Klimczak for clearly illustrating the problem and resolution on their website.

Add an entry to Headers Search Paths for each new Release build configuration:

$(BUILD_DIR)/Release-$(PLATFORM_NAME)/include

Add an entry to Library Search Paths for each new Release build configuration:

$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)

One might wonder why this is needed when we only change build configuration name and it was already working for Release. React Native supports Debug and Release build configurations out of the box, while any other configuration needs to be set up manually.

Sure enough, that fixed it. The answer is that only Release and Debug are supported out of the box, so that additional config is required for non-standard Build Configurations.

Upvotes: 7

Related Questions