Link structure for application and test target

I have a custom platform that I use in my regular App target program, as well as the corresponding UnitTest target. It turns out that this confuses the runtime in such a way that it cannot choose the correct implementation, since it has several options:

objc[35580]: Class AClass is implemented in both ../MyApp.app/MyApp and ../MyApp.app/MyAppTests. One of the two will be used. Which one is undefined.

This, of course, leads to strange behavior if you try to check the hierarchy of object classes or perform other class checks.

So, this boils down to the following two questions:

  • I do not see similar magazines, for example. UIKit, but this structure is also associated with both goals. Did I compile the framework incorrectly?
  • Is this just a trivial configuration issue that I missed?

PS: I already checked similar messages, such as 1 or 2 , but although everything is configured as described, the problem remains.

+4
source share
3 answers

I think that the package should only “read” the frame header files, but not create sources and leave this task in the application (delete the Framework files .mfrom the UnitTest target).

Currently, the application and UnitTest are creating both Framework and duplicate classes.

+2
source

. . SAME framework, , .

, . , , . , .

+2

: Xcode5:

The key is to create a new module testing package, point it to the original target, and then do nothing! If you include the frameworks and source files in the target audience, they will generate these linking errors. It is assumed that the test target "introduces" the test classes to the real target, and does not create a new separate target. Therefore, you just need to import the header files into the test class and write your test cases.

+2
source

Source: https://habr.com/ru/post/1534367/


All Articles