Skip to content

Instantly share code, notes, and snippets.

@jaredsinclair
Created August 22, 2015 16:41
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredsinclair/4de506e108249f39b12d to your computer and use it in GitHub Desktop.
Save jaredsinclair/4de506e108249f39b12d to your computer and use it in GitHub Desktop.
Podfile post-install script for best-practice code signing settings.
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.to_s == 'Beta'
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution'
elsif config.to_s == 'Release'
config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution'
end
end
end
end
@jaredsinclair
Copy link
Author

The default provisioning profile selection Automatic is acceptable so I leave that untouched.

@jaredsinclair
Copy link
Author

Known Issue: It is not possible to specify a particular code signing identity when your project uses different distribution identities depending on the current scheme/config. Alas, we must fallback to trusting that Xcode will select the appropriate identity from the pool of distribution identities.

@jaredsinclair
Copy link
Author

Shout out to @traviscrist for how to construct a post_install script this way. CocoaPods/CocoaPods#3811

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment