Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EMBR-5846] Fix URLSessionDelegate methods forwading based on responds and not only conformance #133

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

ArielDemarco
Copy link
Collaborator

Overview

This PR addresses an issue where some methods from different NSURLSessionDelegate subprotocols (such as NSURLSessionDataDelegate or NSURLSessionTaskDelegate) may be implemented by the original delegate without explicitly declaring conformance to these subprotocols. Probably, this can work because Foundation likely checks whether the object responds to a selector, rather than strictly verifying if it declares conformance to the protocol.

To resolve this, our implementation now performs a similar behavior. If we detect that the original delegate does not explicitly conform to the expected subprotocol but responds to the relevant selectors, we directly forward the calls to the original delegate. This ensures compatibility with delegates that rely on runtime behavior for method resolution.

[WIP: Missing tests]

Copy link

github-actions bot commented Nov 29, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

Copy link

github-actions bot commented Nov 29, 2024

Warnings
⚠️ No CHANGELOG entry added.

Generated by 🚫 Danger Swift against e782e36

@ArielDemarco ArielDemarco marked this pull request as ready for review December 2, 2024 14:23
@ArielDemarco ArielDemarco requested a review from a team as a code owner December 2, 2024 14:23
@NachoEmbrace NachoEmbrace merged commit 1dcd83c into main Dec 4, 2024
6 of 8 checks passed
@NachoEmbrace NachoEmbrace deleted the fix-forwading-basded-on-responds branch December 4, 2024 16:49
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.

2 participants