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"
Chris Carr
Chris Carr
Software Developer

Stay in the loop with our latest content!

Select the topics you’re interested to receive our new relevant content in your inbox. Don’t worry, we won’t spam you.

Chicago Roboto 2020: A Virtual Success

Chicago Roboto 2020: A Virtual Success

January 19, 2021

Looking back on last year’s Chicago Roboto, it was a great opportunity to learn while spending time hanging out with teammates. So, when it was announced that this year’s event was going to be virtual, it was hard not to be disappointed. Then again, with so many great speakers lined up, there was still plenty to look forward to.

Read more
The Measure Of Success: Staying On Track From The Very Beginning

The Measure Of Success: Staying On Track From The Very Beginning

July 6, 2020

Any successful project begins with a clearly defined problem to solve (Are You Solving the Right Problem?). Project stakeholders need to be able to articulate the overriding challenge succinctly from the very start. (Spoiler: this often involves narrowing your vision, and may include…gasp…removing functionality.)

Read more
Time Check

Time Check

June 6, 2019

Read Karl's blog post about an interesting development challenge related to time.

Read more
View more articles