-->

“Invalid Signature, code object not signed at all”

2020-08-22 17:57发布

问题:

I've been browsing Stack for hours in an attempt to try and fix this error, and I've tried everything I can find/think of. I'm submitting an update to an existing app to the App Store, and upon submitting my build, I keep receiving this error:

Invalid signature. Code object is not signed at all. Make sure you have signed your application with a distribution certificate, not an ad hoc certificate or a development certificate. Verify that the code signing settings in Xcode are correct at the target level (which override any values at the project level. Additionally, make sure the bundle you are uploading was built using a Release target in Xcode, not a simulator target.

My app is undoubtedly signed with a distribution certificate, the correct provisioning profile is installed and selected, the profile contains the correct certificate, I've deleted the profile and created a new one in attempt to fix the error, I've reinstalled certificates, restarted Xcode... cleaned the project multiple times, even restarted my system; I'm stumped.

Also: When I do attempt to export the build, even though I've selected to use my provisioning profile and it appears to build with my selected profile, it says it's using "XC [Name of my Profile Here]" provisioning profile. When I check the portal, there's now the profile I created, and a separate profile with the same title with the XC in front of it. Even once I delete this profile on the developer portal, it's recreated? Could this be causing the submission error? Please help.

回答1:

Here is the way I found a script file in the app which caused the error:

  1. Archive the app
  2. Open the archive folder from terminal
  3. Execute the following command grep -r '#!/' *
  4. Review all the files which are returned from the command
  5. Delete all the scripts from Copy Bundle Resources build phase
  6. Profit


回答2:

I had the same issue. In my case I am including my own frameworks, which has some script files, I removed those script files from the frameworks targets, and the issue went away.



回答3:

This issue occurred for me when one of my Cocoapods incorrectly specified the resources in it's podspec so that scripts were inappropriately included.

Updating the suspected podspec to only include resource file types resolved the issue. In this case, I added xcassets to the spec.

s.resources = '<path>/**/*.xcassets'