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

Calling +[GTMSessionUploadFetcher fetcherWithSessionIdentifier:] incorrectly returns GTMSessionFetcher #402

Closed
bhamiltoncx opened this issue Sep 20, 2024 · 0 comments · Fixed by #403

Comments

@bhamiltoncx
Copy link
Member

bhamiltoncx commented Sep 20, 2024

+[GTMSessionUploadFetcher fetcherWithSessionIdentifier:] is declared to return instancetype, so it should return GTMSessionUploadFetcher*.

In reality, that method has no implementation in GTMSessionUploadFetcher.m, so it always returns GTMSessionFetcher*. That means calling GTMSessionUploadFetcher-only methods on the resulting object will crash, since they're not implemented.

The method +[GTMSessionUploadFetcher uploadFetcherForSessionIdentifier:] is implemented to return the correct type, so we can implement +[GTMSessionUploadFetcher fetcherWithSessionIdentifier:] to thunk through to that method.

bhamiltoncx added a commit to bhamiltoncx/gtm-session-fetcher that referenced this issue Sep 20, 2024
`+[GTMSessionUploadFetcher fetcherWithSessionIdentifier:]` is declared to return instancetype, so it should return `GTMSessionUploadFetcher*`.

In reality, that method has no implementation in `GTMSessionUploadFetcher.m`, so it always returns `GTMSessionFetcher*`. That means calling `GTMSessionUploadFetcher`-only methods on the resulting object will crash, since they're not implemented.

The method `+[GTMSessionUploadFetcher uploadFetcherForSessionIdentifier:]` is implemented to return the correct type, so this PR implements `+[GTMSessionUploadFetcher fetcherWithSessionIdentifier:]` to thunk through to that method.

Fixes: google#402
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 a pull request may close this issue.

1 participant