Xcode 9 produces invalid Code Signature

I just switched a macOS project to Xcode 9 and have trouble getting the produced app to work on older systems. I'm able to use the app on 10.13 and 10.12, but on 10.11 and 10.10 it crashes on launch with EXC_CRASH (Code Signature Invalid). I tried both Development Signature and Developer ID Signature, neither works. Even App Review rejected the app because of that (so App Store Signature is broken too).

I regenerated all provisioning profiles and even created a new Developer ID Certificate, nothing helped. Xcode doesn't complain either about missing Entitlements or incompatible profiles.

Any help is appreciated, I'm clueless right now.

Replies

Probably to obvious, you have certainly checked.


Which deployment target have you ?

This might be the same bug like in Xcode 8. If you get your app rejected during App Store review due to a "Code Signature Invalid" crash, you could try the following if you let Xcode manage code signing automatically in your project:

1) Delete all your provisioning profiles in your Apple developer account

2) Rebuild and archive your app

3) Before uploading it to the app store, you are shown the provisioning profile in use. There's a small link next to it. Click it and it shows you a cached version on your Mac in Finder. If the creation date of this one is old, move it (and all other cached provisionining profiles) away, e.g. to the Desktop folder.

4) Cancel the upload to the app store.

5) Rebuild and archive your app. This time Xcode is forced to create a new provisioning profile and a new upload to the app store should now work.


This worked for me. I hope it helps.


== Matthias

10.10. I just switched from Xcode 8 to 9, I didn't change the code signing settings or deployment target.

Xcode doesn't recreate the profiles. When trying to upload the app to the App Store, it asks me to select the profiles without offering to automatically create them. I set the Code Signing Style in Xcode to automatic.


Edit:

I just recreated all the profiles manually, didn't help either.

I think I tracked down the issue. While manually checking the code signature of every framework contained in the bundle using codesign -vv, I discovered some frameworks returned an error with the following message: the sealed resource directory is invalid. Interestingly, only the frameworks built using Xcode 9 and Swift 4 are affected, older ones created with Xcode 8 and ObjC are fine. Also, the check doesn't produce an error on 10.12.


Edit:

It was because of the deployment target of the frameworks, but this also doesn't solve main issue.


Edit 2:

In fact, this solved the issue for the Developer ID-signed version, but the MAS-signed version is still broken.

Hi, I am having this exact same issue. Did you every get it resolved for the Mac App Store version?

Thanks,

Ray

Yes I did, but somehow forgot to post it here. In my case, both targets (MAS & Dev ID version) depend on other targets, like helper apps and app extensions, which are being copied into the main app bundle. I've configured the schemes of the main apps to automatically build the schemes of their dependencies, but for some reason this configuration got messed up (Xcode sometimes crashed when I edited the schemes). Xcode ended up building the wrong dependencies which themselves were signed with a code signature not matching the one of the main app. After fixing the schemes I was able to create a valid bundle.

Hi APPLE!, please give me a developer certificate !. This is for personal use. I have an iPhone 5s

Hi APPLE!, best platform!. please give me a developer certificate !. This is for personal use. I have an iPhone 5s.

Hi APPLE!, best platform!. please give me a developer certificate !. This is for personal use. I have an iPhone 5s. Please!, please...