Fix Code Sign Error When Building with CocoaPods

November 30, 2015

Code Sign Error Building CocoaPods Framework Targets

I would like to share a recent troubleshooting experience with the dependency manager, CocoaPods, and creating an AdHoc build for a project that contains Swift language frameworks. Hopefully the solution we found will help you if you ever run into this type of error.

Code Sign error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID "(null)" were found.
CodeSign error: code signing is required for product type 'Framework' in SDK 'iOS 8.4'

Adding a Swift Framework to Objective-C Project

Recently we added a new Swift language framework, PromiseKit, to an existing Objective-C project. We have been using CocoaPods, since day one with the project, but this was the first Swift code being integrated into the Xcode Workspace. Newer versions of CocoaPods (since version 0.36 ) have added support for Dynamic Frameworks via the use_frameworks! configuration option. This is the preferred way to integrate a Swift language 3rd party library into a Project. Initially, all went well - the project built and ran locally on the iOS Simulator with no trouble.

Xcode Build Error on Continuous Integration Server

Our first sign of trouble was when the new code was committed and pushed and a build was run. Every pre-existing 3rd party library Pod dependency that was not one of the new Frameworks (all Objective-C static libraries) failed to build with a Code Sign Error. At first we tried the typical code signing troubleshooting: checking the signing certificate and updating the provisioning profile, but these did not fix the error or change the messages in the build log.

Swift Framework Libraries Require Code Signing but NOT Objective-C

Digging into the problem a bit further, we discovered that the new Swift framework was building properly and just the pre-existing Objective-C Pods (formerly static libraries) were failing with the Code Sign Error. Time to hit the Google!
After much research on CocoaPods GitHub Issues page and looking over some similar problems with the latest iOS/OS X dependency manager Carthage, I realized that the Objective-C libraries should NOT be getting code signed. Swift frameworks require code signing because they embed the Swift standard library and runtime, enabling use of older Swift code in a newer project. Apple requires Code Signing to verify the runtime code that’s being copied into an iOS app (helps enforce the iOS security sandbox). The old school Objective-C static libraries do not need this and actually do not even support it, hence the weird build error about “No signing identities matching team ID (null).”

The Solution - Disable Code Signing

One solution would be to manually edit each Pod library target and disable Code Signing. Not a great option since those build settings will be re-created each time pod install is re-run. After perusing the CocoaPods documentation, we found the solution. A “Post Install” script that modifies the Pod targets before they are saved to disk (and integrated into the Xcode Workspace.) We manually disable Code Signing via the appropriate Build Settings for each of the Pod dependencies. Add this to the bottom of your Podfile and your Code Signing error will be resolved!

post_install do |installer|
 installer.pods_project.targets.each do |target|
 target.build_configurations.each do |config|
 config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
 config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
 config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
 end
 end
end
Chris Carr
Chris Carr
Infrastructure Engineer

Looking for more like this?

Sign up for our monthly newsletter to receive helpful articles, case studies, and stories from our team.

Benefits and practical applications of AI
Business Development

Benefits and practical applications of AI

January 10, 2025

Artificial intelligence (AI) has the potential to transform your business, but it’s important to know where it fits into your strategy. This blog explores the key benefits of AI—like efficiency, personalization, and predictive insights—and highlights practical examples of how businesses are using it to deliver real results. Plus, we share tips on evaluating whether AI is the right tool for your challenges.

Read more
MichiganLabs’ approach to product strategy: Driving software success
Process Team

MichiganLabs’ approach to product strategy: Driving software success

February 12, 2024

Read more
Delivering software value faster: How to track ROI from day one
Business Development

Delivering software value faster: How to track ROI from day one

October 24, 2024

Do you feel under pressure to innovate quickly, make smart investments, and prove the value of your digital products? How do you measure the return on investment (ROI) from a software project, especially when you can’t afford to wait six months to a year to verify measurable results?

Read more
View more articles