문제

I'm trying to create a new unit test build target for my iphone app. The problem I'm running into is that my source code "group"'s Target Membership options are grayed out.

I did delete the original "Classes" folder, and created new "SourceCode" folder with an actual disk structure (thanks xcode). I imported it as a group, not a folder. It added automatically to my standard build target's Compile Sources, but I can't add it or drag it into my new target.

Any thoughts?

alt text http://img.skitch.com/20100118-mhurmqc33ecaq4xq3y2e5k3hs4.jpg

도움이 되었습니까?

해결책 2

cdespinosa's answer is on the right track, but not really correct. The sources actually do go into the unit test target, but you only need to include the ones covered by tests.

I figured it out, and the issue is actually that if a group contains any file that cannot be included (header files for example), the Info dialog is not smart enough to only deal with those files and just locks you out. You have to manually select each .m file, even if you want to include everything in the group. If you have a huge project, I would suggest making a "smart group" (as opposed to xcode's normal "dumb group"), which will let you filter only .m files.

Why you ask? Why is xcode able to figure this out when you import a bunch of files, some of which cannot be included in the build, but unable to make the same distinction for existing files? Good question. Par for the xcode course, imo.

다른 팁

First, your sources don't go into the Unit Test target. Only the unit test sources themselves should go in that target. Second, the Compile Sources build phase can't build a group, only individual files. So I'd disbelieve that even if your group is in the target, that it's in the right build phase or that it's sources will be compiled.

Uncheck the target to remove the group from it, then select the source files and drag them onto the target.

This happened to me with Xcode 10.2 and a rather old project. The cause for me was that in the target settings the item "Headers" was missing for the target in Build Phases. Click the +, and select "New Headers Phase". Now you can properly add the headers to the target.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top