Linda Keating
Linda Keating

Reputation: 2435

Codesign failed with exit code 1 - failing to build copy resources

I realise that this question has been asked quite a few times already, but I have tried to solve using a lot of the given answers with no luck.

CodeSign /Users/XXXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXXX-blligpejpeysabczydnolvooizok/Build/Products/Debug-iphoneos/XXXXXXXX.app
    cd /Users/XXXXXXXX/Documents/Development/Native/tomhais
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer: XXXXXXX"
Provisioning Profile: "iOS Team Provisioning Profile: XXXXXX"
                      XXXXXXXX

    /usr/bin/codesign --force --sign XXXXXXXXX --entitlements /Users/XXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXX-XXXXXXXX/Build/Intermediates/tomhais.build/Debug-iphoneos/XXXXXX.build/XXXXXXX.app.xcent --timestamp=none /Users/XXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXX-XXXXXXXX/Build/Products/Debug-iphoneos/tomhais.app

/Users/XXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXX-XXXXXXXX/Build/Products/Debug-iphoneos/XXXXXXXX.app: code object is not signed at all
In subcomponent: /Users/XXXXXXXX/Library/Developer/Xcode/DerivedData/XXXXXXXX-XXXXXXXX/Build/Products/Debug-iphoneos/XXXXXXXX.app/0CeadLitir.png
Command /usr/bin/codesign failed with exit code 1

I have tried the following:

  1. Deleted my developer account and added it again
  2. Deleted all the provisioning profiles and re-downloaded them
  3. Checked the key-chain access to make sure that they use system defaults
  4. Checked that my Code Signing is pulling in the right certificates
  5. Deleted the image from resources/ removed it from `Build Phases / Copy Bundle Resources and added it again'
  6. Rebooted the machine
  7. Cursed at the machine

Any further ideas of what I might try?

enter image description here

Upvotes: 3

Views: 10318

Answers (6)

Navs Nandu
Navs Nandu

Reputation: 1

Having a folder named resources was the problem. I had to spend 2 days figuring out what's going on with mp3 files or the way I am setting up viewControllers as I am new to UIKIT. I learned SwiftUI first. Apple has to throw an error for using Resourses folder type in the project :( , Just rename the folder name and clean & build & thanks me later.

September 7th 2024, this is still the solution.

Upvotes: 0

Giovanni Lozano
Giovanni Lozano

Reputation: 1

I was working with the ARKit, and the problem appears when I try to convert a .dae element into a .scn after that I try to compile but the non zero exit error appears.
I try everything above but nothing worked for me. But I notice that in the project inside the art.scnassets folder was my new file but without the .snc extension.
So the solution was very simple, I just add the .snc to my file, I Clean My Build Folder from the Product menu in Xcode, I ran it again and that Works for me.

Upvotes: 0

Max Wang
Max Wang

Reputation: 277

I had the same problem and spent about a day by trying all suggestions.

Finally, I have solved the problem.

  1. Close Xcode.
  2. Open "Keychain Access.app", find and remove all "Apple Worldwide Developer Relations Certification Authority".
  3. Login to developer.apple.com and remove development and distribution certificate.
  4. Open Xcode again and check "Automatically manage signing". Then Xcode(should be 11.4.1 or later) will download renewed WWDR certificate automatically and generate development certificate.
  5. Clean project and build.

Upvotes: 0

Praneeth Vithanage
Praneeth Vithanage

Reputation: 211

First, check your code have lots of useless variables and remove them, then then x code top bar product -> clear and build the folder and run

Upvotes: 0

Pichirichi
Pichirichi

Reputation: 1510

I had the same problem, what resolved it was lock/unlock keychain login as described here: link

Upvotes: 0

Tim R.
Tim R.

Reputation: 1650

What I found was that having a folder named "resources" in the application bundle will cause code sign to fail. This seems to be an undocumented consequence of some implementation detail of iOS apps or code signing, I think. An empty project with just a resources folder with one random file in it reproduced the issue.

I couldn't easily rename the folder with our shared codebase so my solution was to put my "resources" folder in a parent folder with a different name, and adjust the way our resource path was built.

Upvotes: 22

Related Questions