Search code examples
iosframeworksapp-storecodesigncarthage

How should my copy-frameworks Run Script look with nested Carthage frameworks?


I have a Carthage framework A that is dependent on another of my Carthage frameworks B. That framework B is dependent on a framework C. My Cartfile does not have C listed, but as the docs describe, it is downloaded on carthage update. In my Run Script I have:

$(SRCROOT)/Carthage/Build/iOS/A.framework
$(SRCROOT)/Carthage/Build/iOS/B.framework
$(SRCROOT)/Carthage/Build/iOS/C.framework

And:

$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/A.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/B.framework
$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/C.framework

This builds fine for me, but when I go to submit to the App Store I get Code signing "A.framework" failed

In the logs I see Running /usr/bin/codesign for

/var/folders/1y/hdyf678f66897f_fafjdkdk89f8d/T/XcodeDistPipeline.7bM/Root/Payload/MyApp.app/Frameworks/A.framework/Frameworks/B.framework/Frameworks/C.framework

And the next line after that same string with a path to C.framework replacing existing signature, then code object is not signed at all on the line after that.

Do I need to specify in my Run Script the path to each sub framework (or in my case sub sub framework)?

I've tried $(SRCROOT)/Carthage/Build/iOS/C.framework/Frameworks/B.framework/Frameworks/C.frameworks, but then it won't compile because it can't find a file at that path (although when I cd to that path it exists).

PS:

B.framework also has a Run Script for C.framework with the same format as the main app


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)