Xcodeproj
Xcodeproj copied to clipboard
Is it possible to update System Capabilities to add associated domains (for multiple target app)?
I wonder is it possible to update xcodeproj* file ('SystemCapabilities') to add specific associated domains for different target?
I need to add smth like this 1 Add to the proj file "SystemCapabilities" => {"com.apple.SafariKeychain" => {"enabled" => 1}}} (for each target) 2 Update app entitlements (I can update entitlement file but without step 1 it doesn't work)
I've tried the following:
targets_dsym.each do |scheme_name, bundle_identifier|
proj = Xcodeproj::Project.open('/Users/ELL/MyProj/MyProj.xcodeproj')
currentTarget = proj.native_targets.find { |target| target.name == scheme_name}
targetid = currentTarget.uuid
attributes = {}
attributes[targetid] = {"SystemCapabilities" => {"com.apple.SafariKeychain" => {"enabled" => 1}}}
proj.root_object.attributes['TargetAttributes'] = attributes
current_entitlement_path = entitlement_path(scheme_name)
set_info_plist_value(value: "applinks:www.test.com2", key: "com.apple.developer.associated-
domains", path: current_entitlement_path)
proj.save()
end
I managed to update entitlements (already have them), but my xcodeproj* is broken.
Thanks if you'll find time to look at this.
I actually managed to save it without your step one
lane :add_domain_to_entitlement do |values|
domain = values[:domain]
scheme_name = values[:scheme]
proj = Xcodeproj::Project.open('../Trader.xcodeproj')
current_entitlement_path = "Trader/#{scheme_name}.entitlements"
domains = get_info_plist_value(path: current_entitlement_path, key: "com.apple.developer.associated-domains")
newDomain = "applinks:#{domain}"
domains = domains.push(newDomain)
set_info_plist_value(value: domains, key: "com.apple.developer.associated-domains", path: current_entitlement_path)
proj.save()
end
fyi I have multiple domains that's why I push into the array.