Skip to content

fix(signing): enable capabilities through apple id sessions - #178

Merged
arxdeus merged 2 commits into
mainfrom
fix/apple-id-capabilities
Nov 25, 2026
Merged

arxdeus merged 2 commits into
mainfrom
fix/apple-id-capabilities

Conversation

@arxdeus

@arxdeus arxdeus commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

With an Apple ID session, App ID capabilities such as HealthKit were never switched on, yet every run printed Enabled the HEALTHKIT capability on .... The issued profile lacked com.apple.developer.healthkit and HKHealthStore.requestAuthorization failed on device.

developerservices2 needs a capability relationship on the bundleIdCapabilities create (xtool sends it only for that API: "not public but required iff using ds2 API"). Without it Apple answers 409, and both clients read every 409 as "already enabled".

  • AscPayloads.capability takes linkCapability, which adds the capabilities relationship. Only DeveloperServicesClient sets it, so the App Store Connect payload is unchanged.
  • developerservices2 lists a capability without attributes.capabilityType, so the listing was always empty there. The type is now read from the resource id, <bundleIdResourceId>_<TYPE>, and entries with enabled: false are skipped. An enabled capability is no longer requested again on every run.
  • A 409 is accepted only when the capability is listed afterwards. Otherwise the client throws CapabilityRefused, in both clients.
  • A capability Apple refuses or rejects with another status produces a warning and the profile is issued without it, instead of reporting it as enabled or failing the build.

Validation:

  • Tested by the reporter on Linux x64 with a free Apple ID at ce85dc7: HealthKit is enabled and present in the profile for a new and an existing App ID. The listing fix that followed is covered by unit tests only.
  • New tests for the developerservices2 payload and listing shape, the App Store Connect payload staying public, 409 with the capability on and off, and the provisioning warnings
  • dart analyze passes for apple_developer_kit and xcross
  • test/appstoreconnect passes

Closes #177

developerservices2 refuses a bundleIdCapabilities create without a
capability relationship, answering 409. Both clients read any 409 as
"already enabled", so HealthKit and friends were never switched on while
provisioning reported them enabled on every run.

Link the capability resource on the developerservices2 create, and only
accept a 409 when the capability is actually listed afterwards. A refused
capability now warns and the profile is issued without it.

Closes #177
@arxdeus

arxdeus commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

@lasitha-b, hi, could you please try the fix from this branch and report if it works for you

xcross update --ref fix/apple-id-capabilities

@lasitha-b

Copy link
Copy Markdown

Thanks! Tested ce85dc7 (xcross update --ref fix/apple-id-capabilities) on Linux x64 with a free Apple ID and an iOS 27 device. It works:

  • New App ID: a fresh Flutter app whose Runner.entitlements has com.apple.developer.healthkit. The first run turned HealthKit on, and the issued profile has com.apple.developer.healthkit, com.apple.developer.healthkit.access and com.apple.developer.healthkit.background-delivery.
  • Existing App ID: after deleting its cached profile, the new profile has HealthKit again. The app installs and launches.

One leftover: on developerservices2, listEnabledCapabilities never finds the capability, so every run sends the create again and prints Enabled the HEALTHKIT capability on ... even though it's already on. The ds2 entries have no attributes.capabilityType:

{
  "type": "bundleIdCapabilities",
  "id": "<bundleIdResourceId>_HEALTHKIT",
  "attributes": {
    "ownerType": "BUNDLE",
    "enabled": true,
    "entitlements": [
      { "key": "HEALTHKIT", "profileKey": "com.apple.developer.healthkit", "...": "..." },
      { "key": "HEALTHKIT_DEVELOPER_ACCESS", "...": "..." },
      { "key": "HEALTHKIT_BACKGROUND_DELIVERY", "...": "..." }
    ],
    "settings": null,
    "editable": true,
    "inputs": null,
    "responseId": "..."
  },
  "relationships": {
    "capability": { "links": { "self": "...", "related": "..." } },
    "...": "..."
  }
}

The capability relationship only has links, no data, so the id suffix after <bundleIdResourceId>_ looks like the only reliable place for the type (or attributes.entitlements[].key, but that has several keys per capability). In my run Apple accepted the repeated create, so it's only noise for now. It does affect the new 409 check, though: on an Apple ID session, a 409 for a capability that really is on would be reported as CapabilityRefused, because the listing never contains it.

@github-actions

This comment has been minimized.

developerservices2 lists a capability without attributes.capabilityType
and with a links-only capability relationship, so the listing came back
empty: every run sent the create again, and a 409 for a capability that
is on would have been reported as refused. Read the type from the
resource id, <bundleIdResourceId>_<TYPE>, and skip disabled entries.

A capability Apple rejects with any other status, or a backend that
refuses the create, now warns and the profile is still issued instead of
failing the build.
@github-actions github-actions Bot deleted a comment from arxdeus Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Integration simulator report

xcross: 0f0d4dc54d27 · xcross_examples: c46344989849

Failed jobs

✅ No failed jobs.

Flutter

Host App Status Screenshot
macos-15 (native) flutter-example ✅ Ready 🖼️ Open image
ubuntu-24.04 flutter-example ✅ Ready 🖼️ Open image
ubuntu-24.04-arm flutter-example ✅ Ready 🖼️ Open image
windows-11-arm flutter-example ✅ Ready 🖼️ Open image
windows-2022 flutter-example ✅ Ready 🖼️ Open image

Compose

Host App Status Screenshot
macos-15 (native) compose ✅ Ready 🖼️ Open image

Screenshots are Actions artifacts of this run. They open in the browser and expire after 30 days.

Full run

@arxdeus
arxdeus merged commit 9b8fed1 into main Nov 25, 2026
24 checks passed
@arxdeus
arxdeus deleted the fix/apple-id-capabilities branch November 25, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apple ID login: capabilities (e.g. HealthKit) are never enabled; the 409 is read as success

2 participants