Last active
September 21, 2016 14:16
-
-
Save joncardasis/2d63ef7d7da6bf0addafc0b9cb396f0c to your computer and use it in GitHub Desktop.
Replace Xcode Build Settings for Mobile Provisioning using Xcodeproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Usage: | |
# ./{program} {filepath} {provisioning profile} | |
# Example: ./{program} path/to/project/myapp.xcodeproj EB75C687-2F3E-4D57-B895-0F515DA178CC | |
# | |
require 'xcodeproj' | |
project_path = ARGV[0] | |
provisioning_id = ARGV[1] | |
# Replaces the provisioning profile id in the xcproject | |
# project : an Xcodeproj Project | |
# provisioning_id : a provisoning profile string name ex:'EB75C687-2F3E-4D57-B895-0F515DA178CC' | |
def replace_provisioning_profile(project, provisioning_id) | |
project.targets.each do |target| | |
next unless target.name == 'APP-TARGET-NA' || target.name == 'APP-TARGET-EU' | |
target.build_configurations.each do |configuration| | |
configuration.build_settings['PROVISIONING_PROFILE'] = provisioning_id | |
end | |
end | |
end | |
project = Xcodeproj::Project.open(project_path) | |
replace_provisioning_profile(project, provisioning_id) | |
# Save the project | |
project.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment