Search code examples
iosapp-storecode-signingcarthage

How to code sign a Carthage framework for App Store submission?


I have 2 apps I will be submitting to the App Store that work together. Because of this, I have multiple frameworks that both apps use. I use Carthage to package these up.

When I try to submit to the App Store with an Archived build, I get an error on my own framework Code signing "Authentication.framework" failed.. Authentication.framework is a framework in 3 other frameworks that my app imports.

enter image description here

When I look at the logs I see that in the step IDEDistributionCodesignStep, the 3rd party framework KeychainAccess is correctly signed: Running /usr/bin/codesign <A bunch of parameters here> then signed bundle with Mach-O universal (armv7 arm64) [com.kishikawakatsumi.KeychainAccess]

But when Authentication.framework's turn comes around, the command Running /usr/bin/codesign <A bunch of parameters here> results in

replacing existing signature then code object is not signed at all and /usr/bin/codesign exited with 1.

I saw that KeychainAccess does auto code signing.

enter image description here

So I did the same with the Authentication.framework, but I get the same results. I also tried not auto code signing, and manually code signing with no luck.

I use auto code signing with the actual application being submitted.

I do have copy-frameworks in my app as well. I do NOT have nested frameworks listed within each framework.

enter image description here

and down lower:

enter image description here

Things I've tried

  • Unchecking auto code sign
  • Checking auto code sign with a team
  • Checking auto code sign without a team
  • copy-frameworks Run Script (I have a feeling I'm doing something wrong here, that's why I added the screenshots in case someone catches something I'm doing wrong)

Thanks for the help!

---------------------- Auto Checked No Team ----------------------

enter image description here enter image description here ---------------------- Auto Not Checked ---------------------- enter image description here enter image description here


Solution

  • I had a bunch of issues with my project and nested frameworks. I'll list them here:

    • Only the main app that will be submitted to the App Store should have a Run Script copy-frameworks Phase and it should only copy the top level frameworks.

    • Only a test target should have a Copy Files Phase (I had a Copy Files phase in my framework target)

    • Don't embed any frameworks (unless they are static, but those aren't officially supported as of now).

    • The frameworks shouldn't be code signed themselves (It should be code signed by the main app)