Skip to content

AWSCognitoAuthPlugin fails to compile against the visionOS 27 SDK: excludedCredentials (visionOS 1.1) used under @available(visionOS 1.0); no .visionOS platform in Package.swift #4237

Closed

Description

@mathematica-ai

Describe the bug

AWSCognitoAuthPlugin fails to compile for visionOS when built with the visionOS 27 SDK (Xcode 27).

PlatformWebAuthnCredentials.swift assigns ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest.excludedCredentials — which the visionOS SDK annotates @available(visionOS 1.1, *) — inside an extension annotated @available(iOS 17.4, macOS 13.5, visionOS 1.0, *). Because amplify-swift's Package.swift declares no visionOS platform, SwiftPM derives a visionOS 1.0 deployment floor for the package, so the 1.1 API usage is a hard error:

…/AWSCognitoAuthPlugin/Actions/SignIn/WebAuthn/PlatformWebAuthnCredentials.swift:116:28: \
error: 'excludedCredentials' is only available in visionOS 1.1 or newer

This blocks every visionOS app that depends on AWSCognitoAuthPlugin — including apps that never use WebAuthn/passkeys — when building against the visionOS 27 SDK.

Steps to reproduce

  1. A visionOS app target depending on amplify-swift AWSCognitoAuthPlugin.
  2. Build for the visionOS 27 simulator with Xcode 27 (visionOS 27.0 SDK).
  3. Compilation of the AWSCognitoAuthPlugin target fails in PlatformWebAuthnCredentials.swift at the excludedCredentials assignment.

Root cause

  • Package.swift → platforms: [.iOS(.v13), .macOS(.v12), .tvOS(.v13), .watchOS(.v9)] — no .visionOS, so the visionOS deployment floor derives to 1.0.
  • extension PlatformWebAuthnCredentials: CredentialRegistrantProtocol is @available(iOS 17.4, macOS 13.5, visionOS 1.0, *).
  • Inside create(with:):
    platformKeyRequest.excludedCredentials = options.excludeCredentials.compactMap { credential in
        return .init(credentialID: credential.id)
    }
    In the visionOS 27 SDK, excludedCredentials is @available(visionOS 1.1, *). With a visionOS 1.0 floor and no if #available guard, this is an error. (Earlier visionOS SDKs evidently annotated this differently / did not enforce it, so it surfaces specifically with the visionOS 27 SDK.)

Suggested fix

Any of:

  1. Guard the usage: wrap the excludedCredentials assignment in if #available(visionOS 1.1, iOS 17.4, *), or
  2. Raise the availability of the enclosing create(with:) / extension to visionOS 1.1, and/or
  3. Declare a visionOS platform in Package.swift so consumers and the package itself get a correct (≥ 1.1) floor.

Consumer workaround (until fixed)

Force the package's visionOS deployment target up at build time — command-line build settings apply to SwiftPM package targets:

xcodebuild … XROS_DEPLOYMENT_TARGET=27.0 build

Environment

  • Amplify version: 2.51.1 (also present in the latest 2.58.3 — the Package.swift platforms and the unguarded usage are unchanged)
  • Dependency manager: Swift Package Manager
  • Xcode: 27.0 (27A5194q), Swift 6.4
  • SDK / target: visionOS 27.0 (simulator and device), arm64-apple-xros27.0

Activity

  1. mattcreaser commented on Jun 26, 2026

    @mattcreaser
    Member

    We'll look into a possible fix here.

  2. added
    bugSomething isn't working
    authIssues related to the Auth category
    and removed on Jun 26, 2026
  3. dawsonamf commented on Jul 14, 2026

    @dawsonamf
    Contributor

    Hey! I ran into this while working on a visionOS app with the Xcode 27 beta. I'm a professional Apple platforms developer and I've been running the fix from #4250 for a few days now with no issues.

    A quick note: As far as I can tell, the suggested if #available(visionOS 1.1, *) approach won't compile against current SDKs. Both the latest Xcode and the Xcode 27 beta mark excludedCredentials as API_UNAVAILABLE(visionos) in the AuthenticationServices headers. Apple seems to have changed the annotation between betas, the "visionOS 1.1 or newer" wording comes from an earlier 27 beta. The #if !os(visionOS) guard builds under both annotation regimes, so that's what the PR does.

    I ran the AWSCognitoAuthPlugin unit test suite on iOS 26.1/27.0 and visionOS 26.1/27.0 simulators, and everything passes.

  4. added a commit that references this issue on Jul 14, 2026
    c89a6b9
  5. github-actions commented on Jul 14, 2026

    @github-actions
    Contributor

    This issue is now closed. Comments on closed issues are hard for our team to see.
    If you need more assistance, please open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

  6. harsh62 commented on Jul 14, 2026

    @harsh62
    Contributor

    Hey Guys.. I have merged the fix and it will be released soon in the next cycle. Thanks for the contribution and your patience on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to the Auth categorybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions