Skip to content

Commit d1f8296

Browse files
authored
Fix the issue where the request's completion handler is not invoked in certain scenarios (#202)
1 parent 51163d6 commit d1f8296

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

.pubnub.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
---
22
name: swift
33
scm: github.com/pubnub/swift
4-
version: "8.3.0"
4+
version: "8.3.1"
55
schema: 1
66
changelog:
7+
- date: 2025-01-24
8+
version: 8.3.1
9+
changes:
10+
- type: bug
11+
text: "Fix the issue where the request's completion handler is not invoked in certain scenarios."
712
- date: 2025-01-20
813
version: 8.3.0
914
changes:
@@ -653,7 +658,7 @@ sdks:
653658
- distribution-type: source
654659
distribution-repository: GitHub release
655660
package-name: PubNub
656-
location: https://github.com/pubnub/swift/archive/refs/tags/8.3.0.zip
661+
location: https://github.com/pubnub/swift/archive/refs/tags/8.3.1.zip
657662
supported-platforms:
658663
supported-operating-systems:
659664
macOS:

PubNub.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,7 @@
39993999
"@loader_path/Frameworks",
40004000
);
40014001
MACOSX_DEPLOYMENT_TARGET = 10.15;
4002-
MARKETING_VERSION = 8.3.0;
4002+
MARKETING_VERSION = 8.3.1;
40034003
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
40044004
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
40054005
MTL_FAST_MATH = YES;
@@ -4050,7 +4050,7 @@
40504050
"@loader_path/Frameworks",
40514051
);
40524052
MACOSX_DEPLOYMENT_TARGET = 10.15;
4053-
MARKETING_VERSION = 8.3.0;
4053+
MARKETING_VERSION = 8.3.1;
40544054
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
40554055
MTL_ENABLE_DEBUG_INFO = NO;
40564056
MTL_FAST_MATH = YES;
@@ -4158,7 +4158,7 @@
41584158
"@loader_path/Frameworks",
41594159
);
41604160
MACOSX_DEPLOYMENT_TARGET = 10.15;
4161-
MARKETING_VERSION = 8.3.0;
4161+
MARKETING_VERSION = 8.3.1;
41624162
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
41634163
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
41644164
MTL_FAST_MATH = YES;
@@ -4211,7 +4211,7 @@
42114211
"@loader_path/Frameworks",
42124212
);
42134213
MACOSX_DEPLOYMENT_TARGET = 10.15;
4214-
MARKETING_VERSION = 8.3.0;
4214+
MARKETING_VERSION = 8.3.1;
42154215
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
42164216
MTL_ENABLE_DEBUG_INFO = NO;
42174217
MTL_FAST_MATH = YES;
@@ -4332,7 +4332,7 @@
43324332
"@loader_path/Frameworks",
43334333
);
43344334
MACOSX_DEPLOYMENT_TARGET = 10.15;
4335-
MARKETING_VERSION = 8.3.0;
4335+
MARKETING_VERSION = 8.3.1;
43364336
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
43374337
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
43384338
MTL_FAST_MATH = YES;
@@ -4384,7 +4384,7 @@
43844384
"@loader_path/Frameworks",
43854385
);
43864386
MACOSX_DEPLOYMENT_TARGET = 10.15;
4387-
MARKETING_VERSION = 8.3.0;
4387+
MARKETING_VERSION = 8.3.1;
43884388
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++17";
43894389
MTL_ENABLE_DEBUG_INFO = NO;
43904390
MTL_FAST_MATH = YES;
@@ -4864,7 +4864,7 @@
48644864
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
48654865
);
48664866
MACOSX_DEPLOYMENT_TARGET = 10.15;
4867-
MARKETING_VERSION = 8.3.0;
4867+
MARKETING_VERSION = 8.3.1;
48684868
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
48694869
OTHER_CFLAGS = "$(inherited)";
48704870
OTHER_LDFLAGS = "$(inherited)";
@@ -4907,7 +4907,7 @@
49074907
"$(TOOLCHAIN_DIR)/usr/lib/swift/macosx",
49084908
);
49094909
MACOSX_DEPLOYMENT_TARGET = 10.15;
4910-
MARKETING_VERSION = 8.3.0;
4910+
MARKETING_VERSION = 8.3.1;
49114911
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
49124912
OTHER_CFLAGS = "$(inherited)";
49134913
OTHER_LDFLAGS = "$(inherited)";

PubNubSwift.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 = 'PubNubSwift'
3-
s.version = '8.3.0'
3+
s.version = '8.3.1'
44
s.homepage = 'https://github.com/pubnub/swift'
55
s.documentation_url = 'https://www.pubnub.com/docs/swift-native/pubnub-swift-sdk'
66
s.authors = { 'PubNub, Inc.' => '[email protected]' }

Sources/PubNub/Helpers/Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum Constant {
5757

5858
static let pubnubSwiftSDKName: String = "PubNubSwift"
5959

60-
static let pubnubSwiftSDKVersion: String = "8.3.0"
60+
static let pubnubSwiftSDKVersion: String = "8.3.1"
6161

6262
static let appBundleId: String = {
6363
if let info = Bundle.main.infoDictionary,

Sources/PubNub/Networking/Request/Request.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ final class Request {
102102
deinit {
103103
PubNub.log.debug("Request Destroyed \(requestID)")
104104

105+
let currentState = atomicState.lockedRead { $0 }
106+
let taskState = currentState.taskState
107+
108+
// Ensure that the response is always delivered to the caller. This situation could occur if the task is created
109+
// but not yet resumed, and the session is invalidated in the meantime.
110+
if taskState == .initialized {
111+
let error = PubNubError(.clientCancelled)
112+
atomicState.lockedWrite { $0.error = error }
113+
finish(error: error)
114+
}
115+
105116
atomicState.lockedWrite { $0.purgeAll() }
106117
}
107118

0 commit comments

Comments
 (0)