Apollo iOS: Linker error (Undefined symbol) in unit tests

I recently took ownership of an existing iOS project that was using the 0.33.0 SDK. After upgrading to 1.1.x and 1.2.x, the unit test target fails to link to anything Apollo-related. This happens even if the only Apollo-related line of code in the tests is

        let store = ApolloStore(cache: InMemoryNormalizedCache())

In other words, I’m not doing anything with mock data, or even initializing the ApolloClient.

Undefined symbols for architecture x86_64:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol: _$s6Apollo0A5StoreC5cacheAcA15NormalizedCache_p_tcfC
Undefined symbol: _$s6Apollo0A5StoreCMa
Undefined symbol: _$s6Apollo23InMemoryNormalizedCacheC7recordsAcA9RecordSetV_tcfC
Undefined symbol: _$s6Apollo23InMemoryNormalizedCacheCAA0dE0AAWP
Undefined symbol: _$s6Apollo23InMemoryNormalizedCacheCMa
Undefined symbol: _$s6Apollo9RecordSetV17dictionaryLiteralACSS_SDySSs11AnyHashableVGtd_tcfC

This is an M1 Mac, targeting an iPhone 14 simulator running iOS 16.2. I’m using Swift Package Manager in Xcode to manage the Apollo dependencies, so if it’s building Apollo from source, I’m not sure why it can’t find a given architecture’s symbols. If I add any of the Apollo frameworks directly to the unit test target’s Link Binary With Libraries build phase, it tells me that ApolloAPI wasn’t compiled for testing.

0.33.0 didn’t have any of these problems. What else should I look for?

Hi @jrtibbetts, it’s difficult to debug these linker errors without being able to look at the project. I suggest removing all the current links and starting from what you know you need into which modules/targets. If I remember correctly there was a split of Apollo and ApolloAPI, so that may be part of the problem you’re experiencing.