SDK iOS 8.0 中的产品类型单元测试包需要代码签名

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

Code signing is required for product type Unit Test Bundle in SDK iOS 8.0

iosobjective-cxcode

提问by Spentak

Getting

得到

Code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8.0'

SDK“iOS 8.0”中的产品类型“Unit Test Bundle”需要代码签名

My app target is code signing just fine - but my test target is not. I bought a new computer, created a new development certificate from the computer, updated the provisioning profile accordingly, installed both, but can't get past this code signing error.

我的应用程序目标是代码签名就好了 - 但我的测试目标不是。我买了一台新电脑,从电脑上创建了一个新的开发证书,相应地更新了配置文件,安装了两者,但无法克服这个代码签名错误。

Any way of wiping all certs/profiles locally so I can reinstall?

有什么方法可以在本地擦除所有证书/配置文件以便我可以重新安装?

Probably some kind of bug.

可能是某种错误。

回答by Spentak

The problem is the project is under source control and every time I pull the .xcodeproj is updated. And since my provisioning profile is different than the one in source control, the Unit Test target automatically switches to "Do not code sign". So I simply have to set the profile there after each git pull.

问题是该项目受源代码控制,每次我拉 .xcodeproj 都会更新。由于我的配置文件与源代码管理中的不同,单元测试目标会自动切换到“不编码签名”。所以我只需要在每次 git pull 之后在那里设置配置文件。

Apparently if deploying to a device, if there is a unit test target, it must be code signed.

显然,如果部署到设备上,如果有单元测试目标,它必须是代码签名的。

Steps:

脚步:

1) Change target to your test target (AppnameTests)

1)将目标更改为您的测试目标(AppnameTests)

enter image description here

在此处输入图片说明

2) Make sure "Code Signing Identity" is NOT "Don't Code Sign". Pick a profile to sign with

2) 确保“代码签名身份”不是“不要代码签名”。选择要签名的个人资料

enter image description here

在此处输入图片说明

That is all I had to change to get it to work.

这就是我必须改变才能让它工作的全部内容。

回答by Z S

I fixed the issue (temporarily) by going to Edit Scheme, then in the Build section, removing my unit test target from being invoked in "Run".

我通过转到 Edit Scheme,然后在 Build 部分中(临时)解决了这个问题,从“Run”中删除了我的单元测试目标。

回答by Olivia Stork

The other advice here didn't help me, but I fixed this error by going to Product > Scheme > Edit Scheme. Then I clicked Buildon the left hand side and deselected any checkboxes next to AppNameTests. I'm using XCode 6.3

此处的其他建议对我没有帮助,但我通过转到Product > Scheme > Edit Scheme. 然后我点击Build左侧并取消选择旁边的任何复选框AppNameTests。我正在使用 XCode 6.3

enter image description here

在此处输入图片说明

回答by Frost

I fixed it by manually selecting a provisioning profile in the build settings for the test target.

我通过在测试目标的构建设置中手动选择配置文件来修复它。

Test target settings -> Build settings -> Code signing -> Code sign identity. Previously, it was set to "Don't code sign".

测试目标设置 -> 构建设置 -> 代码签名 -> 代码签名标识。以前,它被设置为“不要编码签名”。

回答by Ian Zhao

Also, if you set your build target device, the problem will go away when you testing and debugging. The code signed is only need when you trying to deploy your app to an actually physical device fig

此外,如果您设置了构建目标设备,则在测试和调试时问题就会消失。仅当您尝试将应用程序部署到实际物理设备时才需要签名的代码无花果

I changed mine from "myIphone" to simulator iPhone 6 Plus, and it solves the problem while I'm developing the app.

我将我的从“myIphone”改为模拟器 iPhone 6 Plus,它在我开发应用程序时解决了这个问题。

回答by Javier Calatrava Llavería

In my case the problem that I faced was:

就我而言,我面临的问题是:

CodeSign error: code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8.4'

CodeSign 错误:SDK“iOS 8.4”中的产品类型“Unit Test Bundle”需要代码签名

Fortunatelly, the target did not implemented anything, so a quick solution is remove it.

幸运的是,目标没有实现任何东西,因此快速的解决方案是将其删除。

enter image description here

在此处输入图片说明

回答by nirvana74v

If nothing works from above solutions follow these steps

如果上述解决方案无效,请按照以下步骤操作

From Targets select appnameTests Under "Info"

从目标中选择 appnameTests 在“信息”下

Change following

更改以下内容

Bundle Identifier: com.ProjectName.$(PRODUCT_NAME:rfc1034identifier)

to com.ProjectName.appname

Bundle name: $(PRODUCT_NAME)

Bundle name: appname

捆绑标识符:com.ProjectName.$(PRODUCT_NAME:rfc1034identifier)

到 com.ProjectName.appname

捆绑包名称:$(PRODUCT_NAME)

捆绑包名称:appname

Compile & execute

编译执行

回答by Pellet

I was getting this error when running xcodebuild from commandline for integration tests on my work's CI. I managed to get it working by setting the project level setting to codesign. For some reason the target setting was being ignored and it reverted to the project's setting.

从命令行运行 xcodebuild 以对我的工作的 CI 进行集成测试时出现此错误。我设法通过将项目级别设置设置为 codesign 来使其工作。由于某种原因,目标设置被忽略,它恢复到项目的设置。

回答by arniotaki

I solve the problem by changing the 'Provisioning Profile' in the same section ('Code Signing') from Automatic to 'MyProvisioningProfile name'

我通过将同一部分(“代码签名”)中的“配置文件”从“自动”更改为“MyProvisioningProfile 名称”来解决该问题

回答by sahan maldeniya

Hi I face the same problem today. After reading "Spentak"'s answer i tried to make code signing of my target to set to iOSDeveloper, and still did not work. But after i changing "Provisioning Profile" to "Automatic", the project got built and ran without any code signing errors.

嗨,我今天面临同样的问题。阅读“Spentak”的回答后,我尝试将目标的代码签名设置为 iOSDeveloper,但仍然无法正常工作。但是在我将“配置文件”更改为“自动”后,项目构建并运行,没有任何代码签名错误。