I'm totally new to Ruby but managed to change the project based code signing identity and provisioning profile in xcode like so:
#!/usr/bin/env ruby
require 'xcodeproj'
xcproj = Xcodeproj::Project.open("MyProject.xcodeproj")
xcproj.build_configurations.each do |item|
item.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = "iOS Development: xxxxxx xxxx (xxxxxxxxx)"
end
xcproj.build_configurations.each do |item|
item.build_settings['PROVISIONING_PROFILE[sdk=iphoneos*]'] = "628352b1-9b78-xxxx-xxxx-xxxxxxxxx"
end
xcproj.save
My problem is the target based code signing identity and provisioning profile will override the project based one. But I can't find a method to directly set the target based one. Hope someone can help here. Thanks
You can use the
xcodebuild
tool to change the code sign identity and provisioning profile, instead of directly editing the project (.xcodeproj) file:xcodebuild -sdk <iphoneos> -target <target_name> -configuration <Debug> CODE_SIGN_IDENTITY="iOS Development: xxxxxx xxxx (xxxxxxxxx)" PROVISIONING_PROFILE="628352b1-9b78-xxxx-xxxx-xxxxxxxxx"