iOS Unit Testing: Class is implemented in both

扶醉桌前 提交于 2019-11-29 10:55:41

Only add the test class to your test target and none of the iPhone app classes. Then simply import your app name as a module on top of your test class to get access to all app classes.

import MyAppName

Duplicated class implementations while running the test suite: in my case, since the test target has a host app, you don’t need to link the third-party frameworks. I had to clean the "Other Linker Flags" (OTHER_LDFLAGS) from Build Settings because it was linking to all CocoaPods of the workspace.

The answer by @Mundi is correct for some cases.

However, I experienced the same error and what was causing it is that the libPods.a file for Cocoa Pods was being linked in the app target and the test target.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!