ios XCode获取“目标指定产品类型'com.apple.product-type.bundle.unit-test',但'iphoneos'平台没有这样的产品类型”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24090455/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:37:05  来源:igfitidea点击:

XCode getting "target specifies product type 'com.apple.product-type.bundle.unit-test', but there's no such product type for the 'iphoneos' platform"

iosobjective-cxcodeunit-testingxcode6

提问by FireDragonMule

When running my project in XCode, my tests gives this error:

在 XCode 中运行我的项目时,我的测试给出了这个错误:

target specifies product type 'com.apple.product-type.bundle.unit-test', but there's no such product type for the 'iphoneos' platform

It happened after a couple of XCode updates. Does anyone know how to fix this?

它发生在几次 XCode 更新之后。有谁知道如何解决这一问题?

回答by Alex Pretzlav

It looks like Xcode 6 changed the product identifier for ocunit test bundles from com.apple.product-type.bundleto com.apple.product-type.bundle.ocunit-test.

看起来 Xcode 6 将 ocunit 测试包的产品标识符从com.apple.product-type.bundle更改为com.apple.product-type.bundle.ocunit-test

Edit $(ProjectName).xcodeproj/project.pbxprojand replace any instance of com.apple.product-type.bundle.ocunit-testwith com.apple.product-type.bundle. For now you will need to do this any time you open your project with Xcode 6 and then want to open it in Xcode 5.

编辑$(ProjectName).xcodeproj/project.pbxproj并替换com.apple.product-type.bundle.ocunit-testwith 的任何实例com.apple.product-type.bundle。现在,只要您使用 Xcode 6 打开项目,然后想在 Xcode 5 中打开它,您都需要执行此操作。

回答by Idelfonso Gutierrez

What Worked for me was:

对我有用的是:

  1. Delete the launchScreen.storyboard (Move to trash).
  2. Create a new launchScreen.storyboard..From File -> new File ->iOS User Interface -> LaunchScreen (I named the same AND! checked marked for all the targets at the bottom)
  3. Change Deployment Target from 9.1 which is the one I created my project with to 8.3 (this was done for the project and the targets)
  4. Up to this point I was still getting the same error
  5. I just deleted ProjectNameUITest from this section in Xcode picture here
  1. 删除launchScreen.storyboard(移至垃圾箱)。
  2. 创建一个新的launchScreen.storyboard..From File -> new File ->iOS User Interface -> LaunchScreen(我命名相同并且!检查底部所有目标的标记)
  3. 将部署目标从我创建项目的 9.1 更改为 8.3(这是为项目和目标完成的)
  4. 到目前为止,我仍然遇到相同的错误
  5. 我刚刚从这里的 Xcode图片中的这一部分删除了 ProjectNameUITest