From ce7a27ef00f6fc2dea13d579f5d3237cd036f265 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 27 Feb 2024 12:39:39 +0500 Subject: [PATCH] fix: resolve Xcode 15 network runtime warning (#129) (#130) * fix: resolve Xcode 15 network runtime warning (#129) * podspec version bump * tests updated * libraryVersion updated --------- Co-authored-by: Alex Perathoner <31958579+AlexPerathoner@users.noreply.github.com> --- Sources/Uploadcare/Constants.swift | 2 +- Sources/Uploadcare/UploadAPI.swift | 6 ++++-- .../RESTAPIIntegrationAsyncTests.swift | 14 +++++++------- Uploadcare.podspec | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Sources/Uploadcare/Constants.swift b/Sources/Uploadcare/Constants.swift index 460dc09c..3229b15a 100644 --- a/Sources/Uploadcare/Constants.swift +++ b/Sources/Uploadcare/Constants.swift @@ -19,7 +19,7 @@ internal let RESTAPIHost = "api.uploadcare.com" /// Library name internal let libraryName = "UploadcareSwift" /// Library version -internal let libraryVersion = "0.13.0" +internal let libraryVersion = "0.13.1" /// API version internal let APIVersion = "0.7" diff --git a/Sources/Uploadcare/UploadAPI.swift b/Sources/Uploadcare/UploadAPI.swift index 9a44f690..387c8c36 100644 --- a/Sources/Uploadcare/UploadAPI.swift +++ b/Sources/Uploadcare/UploadAPI.swift @@ -544,7 +544,7 @@ extension UploadAPI { _ onProgress: TaskProgressBlock? = nil, _ completionHandler: @escaping TaskResultCompletionHandler ) -> UploadTaskable { - let urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature) + var urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature) // writing data to temp file let tempDir = FileManager.default.temporaryDirectory @@ -552,6 +552,8 @@ extension UploadAPI { if let data = urlRequest.httpBody { try? data.write(to: localURL) + // To avoid a runtime warning in Xcode 15, the given `URLRequest` should have a nil `HTTPBody` + urlRequest.httpBody = nil } let uploadTask: URLSessionUploadTask @@ -640,7 +642,7 @@ extension UploadAPI { /// - completionHandler: Completion handler. #if !os(Linux) @discardableResult - internal func directUploadInForeground( + public func directUploadInForeground( files: [String: Data], store: StoringBehavior? = nil, metadata: [String: String]? = nil, diff --git a/Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift b/Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift index 79cfe365..f8656070 100644 --- a/Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift +++ b/Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift @@ -432,7 +432,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -469,7 +469,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -488,7 +488,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -506,7 +506,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -521,7 +521,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -536,7 +536,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } @@ -552,7 +552,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase { let list = try await filesList.get(withQuery: query) guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else { - XCTFail() + XCTFail("No images found") return } diff --git a/Uploadcare.podspec b/Uploadcare.podspec index 6a9394dc..839bf963 100644 --- a/Uploadcare.podspec +++ b/Uploadcare.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Uploadcare' - s.version = '0.13.0' + s.version = '0.13.1' s.summary = 'Swift integration for Uploadcare' # This description is used to generate tags and improve search results.