I hope my finding will help someone. We faced exactly the same crash in one of our unit tests after tweaking the library dependencies. And the problem was not in the Xcodeproject. May be the reason of the crash is still not clear, but here is the story:
What happened:
We have project A, which depends on library X, and we had library B.
A->X - depends as subproject
A->B - :path => dependency in Podfile.
We decided to refactor B, and make the following:
A -> B, X - both in Podfile (:path =>)
B -> X - Podfile (:path =>)
After that, one of the tests which has no differences with other tests, stated crashing with the issue above.
The problem was in Generics:
S<T: P>: NSObject - service class in A
P - protocol in X
F: P - fake class in TEST target of A (AT)
R: P - class in A
We are using this service in A as follows: S<R>, but in unit tests we need instance of type S<F>.
After moving F: P from AT to A (in Target Membership), the crash disappear. Seems it's something related to : P in F: P - unit test bundle was not able to create S<F>.
P.S. Before we found the solution we tried to change Podfile (:path => ) to normal versioned dependences (pod X, '0.1.0', pod B, '0.1.0') - no effect.