CocoaPods / CocoaPods/Xcodeproj

Is it possible to update System Capabilities to add associated domains (for multiple target app)?

Open
#556 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

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:

```ruby
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with Xcodeproj::Project.open, native_targets, TargetAttributes, and save in the attempted Ruby example, then reproduce the case with multiple targets. Check how existing target attributes are preserved and whether the saved xcodeproj remains valid while adding SystemCapabilities and associated-domain entitlements for each target.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.