Code Sign on Copy does not work for nested frameworks in Xcode 8

Starting in Xcode 8 beta 3, frameworks are no longer code signed unless a development team is specified in the project settings. The release notes state that this is for iOS but it happens for macOS frameworks as well. The release notes state that "Code Sign on Copy" can be used instead. Unfortunately, this does not appear to work for nested frameworks. Let's say I have the following app layout:


App A -> embeds Framework B -> embeds Framework C


If I change my projects settings so that App A does "Code Sign on Copy" for Framework B and Framework B does "Code Sign on Copy" for Framework C, my build fails because Framework C was NOT code signed when copied into Framework B. When Xcode tries to code signing Framework B on copy, it fails because Framework C is not signed.


Is this a bug or is this part of the new expected behavior? If it's "As designed", what is the solution here? Run Script phases to manually code sign frameworks?


I really don't understand why this change was made. Does anyone understand what prompted this?

Maybe I come too late but I was looking for the same answers and I found a sane recommendation in the Carthage wiki:


If the embedded framework in your project has dependencies to other frameworks you must link them to application target (even if application target does not have dependency to that frameworks and never uses them).


This actually makes some sense to avoid conflicts in case if the developer of the app decides to link to FC not knowing that FB already uses FC, and maybe even another version of it.


And also I found an official note here:


https://developer.apple.com/library/content/technotes/tn2435/_index.html


saying one important thing:


The app target is responsible for embedding all of the frameworks, including any frameworks that other frameworks depend on.


See the section "Apps with Dependencies Between Frameworks" for full instructions. This means, if your framework B depends on framework C, you are forced to link FC to FB and FB to A anyway just to be able to build your project, but at the end you should embed both FC and FB into A, so XCode can find and codesign them.


Also, it seems it doesn't matter much whether you embed a framework in General -> Embedded binaries or Build Phases -> Embed Frameworks, because if you drag a .framework into one of these places, it automatically appears in the other place also. I guess, XCode is syncing both those settings, but I might be wrong.

Code Sign on Copy does not work for nested frameworks in Xcode 8
 
 
Q