Xcode 4:无法为测试方案选择目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5305138/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 4: can't select target for test scheme
提问by ctpenrose
I have a project developed in Xcode 3 that I am transitioning to Xcode 4. When I attempt to "test" a build, I get a message that indicates that my application scheme is not configured for testing. I select "Edit Scheme" and I see that I have no tests configured. I choose "+" to add a new test, and am asked to select a target to test. The problem is there aren't any selectable targets provided. How does this target list get populated? For my project, "Build", "Run" and "Profile" are correctly populated with a target.
我有一个在 Xcode 3 中开发的项目,我正在过渡到 Xcode 4。当我尝试“测试”构建时,我收到一条消息,指示我的应用程序方案未配置为进行测试。我选择“编辑方案”,我看到我没有配置测试。我选择“+”添加一个新测试,并被要求选择一个目标进行测试。问题是没有提供任何可选择的目标。这个目标列表是如何填充的?对于我的项目,“构建”、“运行”和“配置文件”正确填充了目标。
采纳答案by Adam Bryzak
If this is for unit tests, make sure your unit test bundle target has its Wrapper Extension set to octest
and Framework Search Path set to $(DEVELOPER_LIBRARY_DIR)/Frameworks
. Then restart Xcode and it should appear as a target in the Test list for the scheme. I'm not sure why restarting Xcode is necessary but it seemed to work for me.
如果这是用于单元测试,请确保您的单元测试包目标将其 Wrapper Extension 设置为octest
并且将 Framework Search Path 设置为$(DEVELOPER_LIBRARY_DIR)/Frameworks
。然后重新启动 Xcode,它应该在方案的测试列表中显示为目标。我不确定为什么需要重新启动 Xcode,但它似乎对我有用。
回答by Richard Lovejoy
I clicked the 'No Scheme' button, and chose Manage Schemes..
我单击了“无计划”按钮,然后选择了管理计划。
I then chose "Auto create schemes now", and it brought back my schemes (iPhone simulator, etc.)
然后我选择了“现在自动创建方案”,它带回了我的方案(iPhone 模拟器等)
回答by ctpenrose
I chose to create a new scheme instead with the desired configuration: scheme configured to "Run", breakpoints on, and build configuration set to "debug" (taken from my XCode 3 project). I thought at first that I could easily have access to debugging, execution, archiving, conveniently from a single scheme, particularly as each of these modes ("run", test", "profile", "analyze", "archive") are selectable from the workspace toolbar. While I may be missing something I can get the desired functionality by creating a new scheme.
我选择使用所需的配置创建一个新方案:方案配置为“运行”,断点打开,并将构建配置设置为“调试”(取自我的 XCode 3 项目)。起初,我认为我可以轻松地从单个方案中方便地访问调试、执行、存档,特别是因为这些模式中的每一种(“运行”、“测试”、“配置文件”、“分析”、“存档”)都是可以从工作区工具栏中选择。虽然我可能会遗漏一些东西,但我可以通过创建一个新方案来获得所需的功能。
回答by MarCoZ
what i did was just push the toggle button "Breakpoints" in the top bar next to the Run, Stop and Scheme buttons. Then when pushing Run, the debugger will attach to the processes, stop on the breakpoints and show variables values. No scheme modification needed.
我所做的只是按下顶部栏中运行、停止和方案按钮旁边的切换按钮“断点”。然后在按下 Run 时,调试器将附加到进程,在断点处停止并显示变量值。无需修改方案。