Skip to content

Commit 2cb236c

Browse files
authored
Fix GoogleUtilities nullability regressions (#2079)
1 parent ceb8392 commit 2cb236c

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

GoogleUtilities.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'GoogleUtilities'
3-
s.version = '5.3.5'
3+
s.version = '5.3.6'
44
s.summary = 'Google Utilities for iOS (plus community support for macOS and tvOS)'
55

66
s.description = <<-DESC

GoogleUtilities/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Unreleased
22

3+
# 5.3.6
4+
- Fix nullability issues. (#2079)
5+
36
# 5.3.5
47
- Fixed an issue where GoogleUtilities would leak non-background URL sessions.
58
(#2061)
6-
79
- Fixed a crash caused due to `NSURLConnection` delegates being wrapped in an
810
`NSProxy`. (#1936)
911

GoogleUtilities/Network/GULNetworkURLSession.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ + (void)handleEventsForBackgroundURLSessionID:(NSString *)sessionID
102102

103103
/// Sends an async POST request using NSURLSession for iOS >= 7.0, and returns an ID of the
104104
/// connection.
105-
- (NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request
106-
completionHandler:(GULNetworkURLSessionCompletionHandler)handler
105+
- (nullable NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request
106+
completionHandler:(GULNetworkURLSessionCompletionHandler)handler
107107
API_AVAILABLE(ios(7.0)) {
108108
// NSURLSessionUploadTask does not work with NSData in the background.
109109
// To avoid this issue, write the data to a temporary file to upload it.
@@ -180,8 +180,8 @@ - (NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request
180180
}
181181

182182
/// Sends an async GET request using NSURLSession for iOS >= 7.0, and returns an ID of the session.
183-
- (NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request
184-
completionHandler:(GULNetworkURLSessionCompletionHandler)handler
183+
- (nullable NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request
184+
completionHandler:(GULNetworkURLSessionCompletionHandler)handler
185185
API_AVAILABLE(ios(7.0)) {
186186
if (_backgroundNetworkEnabled) {
187187
_sessionConfig = [self backgroundSessionConfigWithSessionID:_sessionID];

GoogleUtilities/Network/Private/GULNetworkURLSession.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818

1919
#import "GULNetworkLoggerProtocol.h"
2020

21-
typedef void (^GULNetworkCompletionHandler)(NSHTTPURLResponse *response,
22-
NSData *data,
23-
NSError *error);
24-
typedef void (^GULNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *response,
25-
NSData *data,
21+
NS_ASSUME_NONNULL_BEGIN
22+
23+
typedef void (^GULNetworkCompletionHandler)(NSHTTPURLResponse *_Nullable response,
24+
NSData *_Nullable data,
25+
NSError *_Nullable error);
26+
typedef void (^GULNetworkURLSessionCompletionHandler)(NSHTTPURLResponse *_Nullable response,
27+
NSData *_Nullable data,
2628
NSString *sessionID,
27-
NSError *error);
29+
NSError *_Nullable error);
2830
typedef void (^GULNetworkSystemCompletionHandler)(void);
2931

3032
/// The protocol that uses NSURLSession for iOS >= 7.0 to handle requests and responses.
@@ -41,19 +43,20 @@ typedef void (^GULNetworkSystemCompletionHandler)(void);
4143
completionHandler:(GULNetworkSystemCompletionHandler)completionHandler;
4244

4345
/// Initializes with logger delegate.
44-
- (instancetype)initWithNetworkLoggerDelegate:(id<GULNetworkLoggerDelegate>)networkLoggerDelegate
45-
NS_DESIGNATED_INITIALIZER;
46+
- (instancetype)initWithNetworkLoggerDelegate:
47+
(nullable id<GULNetworkLoggerDelegate>)networkLoggerDelegate NS_DESIGNATED_INITIALIZER;
4648

4749
- (instancetype)init NS_UNAVAILABLE;
4850

4951
/// Sends an asynchronous POST request and calls the provided completion handler when the request
5052
/// completes or when errors occur, and returns an ID of the session/connection.
51-
- (NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request
52-
completionHandler:(GULNetworkURLSessionCompletionHandler)handler;
53+
- (nullable NSString *)sessionIDFromAsyncPOSTRequest:(NSURLRequest *)request
54+
completionHandler:(GULNetworkURLSessionCompletionHandler)handler;
5355

5456
/// Sends an asynchronous GET request and calls the provided completion handler when the request
5557
/// completes or when errors occur, and returns an ID of the session.
56-
- (NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request
57-
completionHandler:(GULNetworkURLSessionCompletionHandler)handler;
58+
- (nullable NSString *)sessionIDFromAsyncGETRequest:(NSURLRequest *)request
59+
completionHandler:(GULNetworkURLSessionCompletionHandler)handler;
5860

61+
NS_ASSUME_NONNULL_END
5962
@end

0 commit comments

Comments
 (0)