Skip to content

Commit

Permalink
Implement +[GTMSessionUploadFetcher fetcherWithSessionIdentifier:]
Browse files Browse the repository at this point in the history
`+[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: #402
  • Loading branch information
bhamiltoncx authored and thomasvl committed Oct 4, 2024
1 parent 5cfe5f0 commit 65615d7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Core/GTMSessionUploadFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ + (NSPointerArray *)uploadFetcherPointerArrayForBackgroundSessions {
return gUploadFetcherPointerArrayForBackgroundSessions;
}

+ (instancetype)fetcherWithSessionIdentifier:(NSString *)sessionIdentifier {
return [self uploadFetcherForSessionIdentifier:sessionIdentifier];
}

+ (instancetype)uploadFetcherForSessionIdentifier:(NSString *)sessionIdentifier {
GTMSESSION_ASSERT_DEBUG(sessionIdentifier != nil, @"Invalid session identifier");
NSArray *uploadFetchersForBackgroundSessions = [self uploadFetchersForBackgroundSessions];
Expand Down

0 comments on commit 65615d7

Please sign in to comment.