Unit Testing in With A Static Library

匆匆过客 提交于 2019-12-03 07:23:49

Make sure you check out the Apple sample code "Unit Tests": https://developer.apple.com/library/ios/#samplecode/UnitTests/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011742

Make sure your library project is set as a Dependancy in your OCUnit test target's build phases, AND it's linked as a library.

Open up your project in Xcode. In the File menu, go to Project Settings... (or Workspace Settings... if you are using a workspace). Click Advanced... and make sure Unique is checked. Clean and rebuild.

Check your BUILD_PRODUCTS_DIR to see if the headers for your library show up in there. If they don't, first check the build phases in your library target to make sure the headers you need are in the Public section (the Project section may work as well, but try Public and see if that solves your issue).

That covers the most common problems people seem to run into in your situation. When in doubt, check the target settings in the UnitTests sample against yours. Good luck!

In addition to Jon Reid's answer, I had to do the following as well: In your test target, go to Build Settings. Set "Always Search User Paths" to YES

In your test target, go to Build Settings. Add the path to your static library headers to Header Search Paths.

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