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

**URL:** <https://community.apollographql.com/t/apollo-ios-linker-error-undefined-symbol-in-unit-tests/6357>\
**Category:** Client SDKs\
**Tags:** mobile, ios\
**Created:** [June 12, 2023, 4:43pm UTC](https://community.apollographql.com/t/apollo-ios-linker-error-undefined-symbol-in-unit-tests/6357 "2023-06-12T16:43:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrtibbetts](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/jrtibbetts/32/4350_2.png) [@jrtibbetts](https://community.apollographql.com/u/jrtibbetts)\
**Post date:** [June 12, 2023, 4:43pm UTC](https://community.apollographql.com/t/apollo-ios-linker-error-undefined-symbol-in-unit-tests/6357/1 "2023-06-12T16:43:02Z")

</div>

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

```auto
        let store = ApolloStore(cache: InMemoryNormalizedCache())

```

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [July 11, 2023, 12:47am UTC](https://community.apollographql.com/t/apollo-ios-linker-error-undefined-symbol-in-unit-tests/6357/2 "2023-07-11T00:47:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:48pm UTC](https://community.apollographql.com/t/apollo-ios-linker-error-undefined-symbol-in-unit-tests/6357/3 "2025-02-06T20:48:39Z")

</div>


