Xcode insists on RemoveHeadersOnCopy for newly added frameworks, regardless of CodeSignOnCopy status
| Originator: | peter.maurer | ||
| Number: | rdar://29636002 | Date Originated: | |
| Status: | Duplicate of 21997191 | Resolved: | |
| Product: | Xcode | Product Version: | 8.1 (8B62) |
| Classification: | Reproducible: | Always |
SUMMARY:
When adding a framework to a project in Xcode 8.1 (8B62), the CodeSignOnCopy attribute is automatically set, as is the (invisible) RemoveHeadersOnCopy attribute. Unchecking CodeSignOnCopy via GUI leaves RemoveHeadersOnCopy set, which then potentially breaks the signature for a pre-signed framework that includes headers.
STEPS TO REPRODUCE:
1) Create a new Xcode project (e.g., a macOS app)
2) Add a Frameworks copy build phase
3) Drag a third-party framework (e.g., Sparkle) to your new copy build phase
4) Note how "Code Sign On Copy" is checked by default
5) Check your project.pbxproj file — you'll see something along these lines:
D07EAE831DFFD780009942C2 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D07EAE821DFFD780009942C2 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); };
6) Uncheck "Code Sign On Copy" for your framework
7) Check your project.pbxproj file again:
D07EAE831DFFD780009942C2 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D07EAE821DFFD780009942C2 /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
EXPECTED RESULTS:
RemoveHeadersOnCopy is disabled along with CodeSignOnCopy. (See Notes for an even better solution.)
ACTUAL RESULTS:
RemoveHeadersOnCopy remains set. If you're using a framework that's already signed and comes with headers, your built product's signature will be invalid due to the framework's being tinkered with after signing.
NOTES:
Ideally, there should be a checkbox for RemoveHeadersOnCopy, similar to the one we have for CodeSignOnCopy.
By the way, the same problem occurs when adding frameworks to old pre-existing projects. Older Xcode versions that didn't auto-check "Code Sign On Copy", on the other hand, also didn't auto-set RemoveHeadersOnCopy, as far as I can tell. So toggling "Code Sign On Copy" for a framework that was added in an old Xcode version won't cause problems, as the framework's headers are never stripped.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!