10 Replies
      Latest reply on Nov 2, 2019 11:16 PM by CYBERTEC
      floschliep Level 1 Level 1 (0 points)

        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.

        • Re: Xcode 9 produces invalid Code Signature
          Claude31 Level 8 Level 8 (7,005 points)

          Probably to obvious, you have certainly checked.

           

          Which deployment target have you ?

          • Re: Xcode 9 produces invalid Code Signature
            ObjectHub Level 2 Level 2 (30 points)

            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

            • Re: Xcode 9 produces invalid Code Signature
              floschliep Level 1 Level 1 (0 points)

              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.

                • Re: Xcode 9 produces invalid Code Signature
                  raymo Level 1 Level 1 (10 points)

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

                  Thanks,

                  Ray

                    • Re: Xcode 9 produces invalid Code Signature
                      floschliep Level 1 Level 1 (0 points)

                      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.

                  • Re: Xcode 9 produces invalid Code Signature
                    CYBERTEC Level 1 Level 1 (0 points)

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