Skip to content

Swift importer generates unusable signature for resumeExternalUserAgentFlow(with:error:) #964

Closed

Description

@oleksandrtatarchuk

Describe the bug
After the addition of resumeExternalUserAgentFlowWithURL:error: in PR #955, the new API appears to be imported incorrectly into Swift.

The Objective-C declaration is:

- (BOOL)resumeExternalUserAgentFlowWithURL:(NSURL *)URL
                                     error:(NSError *_Nullable *_Nullable)error;

However, Swift resolves the method as if the second parameter has type (), resulting in autocomplete like:

flow.resumeExternalUserAgentFlow?(with: url, error: ())

Passing nil or an NSError pointer is not possible, producing errors such as:

'nil' is not compatible with expected argument type '()'

As a result, the new API is effectively unusable from Swift, while the deprecated overload still works.

Screenshots

Image

Environment

  • AppAuth 2.1.0
  • Xcode 26.6
  • iOS 26.5

Suggested fix
Any of:

Make resumeExternalUserAgentFlowWithURL:error: @required (major bump if needed), or
Keep @optional for ObjC but add a Swift overlay / NS_SWIFT_NAME so the documented throwing API is real, or
Update README + Swift examples to stop showing try …(with:) until Swift can call the new method, and document the ObjC-only / wrapper path
Happy to help test a patch.

Activity

  1. w-goog commented on Jul 21, 2026

    @w-goog
    Collaborator

    Thank you so much for the report, Oleksandr! I've put up a PR to fix & we'll release it as a patch :)

  2. mbernson commented on Jul 22, 2026

    @mbernson

    Hi, I ran into the same issue, hence I was taking a look here. The fix in #966 looks good but there's one more thing I'd like to request.

    The new delegate method -[OIDExternalUserAgentSession resumeExternalUserAgentFlowWithURL:error:] is marked as @optional, but I would argue that it should be a required method.

    Having it be optional indicates to me that a certain User Agent Session may or may not implement it. This is not true, as it is the only replacement for the deprecated -[OIDExternalUserAgentSession resumeExternalUserAgentFlowWithURL:] method. Also, resuming the session after authentication is the happy path that should always be possible. An certain Session class should not be able to skip its implementation.
    The call site also becomes a little bit awkward in Swift with the question mark and having to unwrap the result boolean.

    Making the new method required does break source compatibility and therefore a major version bump must be done according to SemVer. This was probably your reason to make it optional in the first place. But I think a major version bump is the better option here.

  3. w-goog commented on Jul 22, 2026

    @w-goog
    Collaborator

    "This was probably your reason to make it optional in the first place. But I think a major version bump is the better option here."

    Indeed, that is the reason - to give our clients time to migrate :) In the next major release, we'll change the deprecation to no longer be a warning, and make the optional method required.

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

    bugtriageIssues that need to be triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions