ChatGPT解决这个技术问题 Extra ChatGPT

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

Getting

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

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.

I had a similar error - my fix was to go into the build settings, and select the provisioning profiles, instead of it automatically selecting them.

S
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.

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)

https://i.stack.imgur.com/khXSU.png

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

https://i.stack.imgur.com/R4Ex9.png

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


i am facing the same problem as mentioned in the above question but not able to figure out how to solve it and i have posted a question regarding the same. stackoverflow.com/questions/27312745/…
Could you please tell me a stepwise process on how to do it.
Had the problem in Xcode 8. Resolution wasn't identical to yours, but close. Thanks for showing me the way!
Also, in addition to setting 'Code Signing Identity' you may have to set the 'Development Team' as well.
Z
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".


Good catch! Why do you say temporarily? It looks like a reasonable solution to me. Did you submit the app to the store?
There's no problem with submitting the app to the App Store. I said "temporarily" because I figured there is a a more permanent fix possible by fiddling around with code signing, but this was the quick hassle-free fix.
Cool, thanks. It looks like good solution to me, the unit test target should not run anyway. +1
Can you explain me more detail? you mean i have to 'build'? and i dont understand 'removing my unit test from being invoked in Run'
O
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 Build on the left hand side and deselected any checkboxes next to AppNameTests. I'm using XCode 6.3

https://i.stack.imgur.com/64Idp.png


@Almo Do not uncheck any boxes underneath "Test", but instead uncheck everything (that you can uncheck) in the row labelled APPNAMEtests. I'll include a screenshot in my answer to help clarify.
I did that, and had everything unchecked except Test. It turned out I had to remove a .plist file to get it to stop trying to code sign the test. My project builds a static library, so none of it needs to be codesigned.
Ahh okay. Well it sure seems like there are a lot of reasons this problem can be caused and just as many ways to fix it. If nobody else mentioned your solution, you might consider posting it as another possible answer.
@huggie ¯\_(ツ)_/¯ Welcome to iOS programming!
@OliviaStork u obliged me. thank you so much for saved my job.
F
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".


Selecting the provisioning profile explicitly worked for me, thanks.
Also make sure the "All" filter is selected at the top, not "Basic".
V
Varun Naharia

https://i.stack.imgur.com/aMu3q.png

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


but but what about if you WANT to deploy your app to a physical device±!
J
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'

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

https://i.stack.imgur.com/0ueEv.png


n
nirvana74v

If nothing works from above solutions follow these steps

From Targets select appnameTests Under "Info"

Change following

Bundle Identifier: com.ProjectName.$(PRODUCT_NAME:rfc1034identifier) to com.ProjectName.appname Bundle name: $(PRODUCT_NAME) Bundle name: appname

Compile & execute


P
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.


a
arniotaki

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


S
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.


B
BrainyMonkey

Sometimes this happens when you download a project from github or other third party tutorial sites.These apps are usually signed with a different identity or company/name.When this happens,if you can't solve the solution,simply create a new xcode project and copy all the header and implementation files into your new project.Also don't forget the dependency files..such as the framework files.This works for me.