Command CodeSign failed with a nonzero exit code

I am having a peculiar issue with an app I am developing.

I am trying to upload it onto App Store Connect but I am getting one error, and a very odd behavior.

The error message I am getting is:

/Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp.pub/Build/Intermediates.noindex/ArchiveIntermediates/MyApp.pub/InstallationBuildProductsLocation/Applications/MyApp.pub.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code

I have cleaned built the directory, I have removed the Derived Data, but this always gets thrown.

It was working fine a few months ago, I have only just got back to working on it.

The other issue I am havving, when I set to archive the app, I set the target as Any iOS Arm Device (arm64), but when it is archiving it switches to my iPhone as the target. I don't prompt it to do this, it just does it.

This is very frustrating.

I'm using a MacBook Air M1, with a macOS Sonoma.

I updated my Xcode the other day, that's Version 15.4 (15F31d).

My App has a minimum target of iOS 15 and a project target of Xcode 13.

Any help is appreciated.

Answered by DTS Engineer in 789421022

One of the files in your project must have a resource fork attached to it. Please check the following reference:

Technical Q&A QA1940 Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed' https://developer.apple.com/library/archive/qa/qa1940/_index.html#//apple_ref/doc/uid/DTS40017555

One of the files in your project must have a resource fork attached to it. Please check the following reference:

Technical Q&A QA1940 Code signing fails with error 'resource fork, Finder information, or similar detritus not allowed' https://developer.apple.com/library/archive/qa/qa1940/_index.html#//apple_ref/doc/uid/DTS40017555

Thanks for your reply, but unfortunately, it doesn't seem to do the job.

The error in full that I am getting this evening is:

CodeSign /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app (in target 'MyApp' from project 'MyApp')
    cd /Users/user/Documents/GitHub/MyApp/MyApp
    
    Signing Identity:     "Apple Development: My Name (REDACTED)"
    Provisioning Profile: "iOS Team Provisioning Profile: REDACTED"
                          (REDACTED)
    
    /usr/bin/codesign --force --sign {REDACTED} --entitlements /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent --generate-entitlement-der /Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app

/Users/user/Documents/GitHub/MyApp/MyApp/DerivedData/MyApp/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code

When I run:

xattr -lr MyApp.app

I get the following output:

MyApp.app/Base.lproj/Main.storyboardc: com.apple.FinderInfo: 
MyApp.app/Base.lproj/Main.storyboardc: com.apple.fileprovider.fpfs#P: 
MyApp.app/Base.lproj/LaunchScreen.storyboardc: com.apple.FinderInfo: 
MyApp.app/Base.lproj/LaunchScreen.storyboardc: com.apple.fileprovider.fpfs#P: 
MyApp.app: com.apple.FinderInfo: 
MyApp.app: com.apple.fileprovider.fpfs#P:

When I run:

xattr -cr MyApp.app

It does something, but I am still presented with the same error.

Now to complicate things, even though I get the same error, the Applications directory isn't being generated.

I can't understand why there would be forks in the StoryBoards, I do have some RSS feeds and links out.

You'll have to clean your files before building and signing your app, not after.

Command CodeSign failed with a nonzero exit code
 
 
Q