Skip to content

Commit ce7a27e

Browse files
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 <[email protected]>
1 parent 3ab0706 commit ce7a27e

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Sources/Uploadcare/Constants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal let RESTAPIHost = "api.uploadcare.com"
1919
/// Library name
2020
internal let libraryName = "UploadcareSwift"
2121
/// Library version
22-
internal let libraryVersion = "0.13.0"
22+
internal let libraryVersion = "0.13.1"
2323

2424
/// API version
2525
internal let APIVersion = "0.7"

Sources/Uploadcare/UploadAPI.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,16 @@ extension UploadAPI {
544544
_ onProgress: TaskProgressBlock? = nil,
545545
_ completionHandler: @escaping TaskResultCompletionHandler
546546
) -> UploadTaskable {
547-
let urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature)
547+
var urlRequest = createDirectUploadRequest(files: files, store: store, metadata: metadata, uploadSignature: uploadSignature)
548548

549549
// writing data to temp file
550550
let tempDir = FileManager.default.temporaryDirectory
551551
let localURL = tempDir.appendingPathComponent(UUID().uuidString)
552552

553553
if let data = urlRequest.httpBody {
554554
try? data.write(to: localURL)
555+
// To avoid a runtime warning in Xcode 15, the given `URLRequest` should have a nil `HTTPBody`
556+
urlRequest.httpBody = nil
555557
}
556558

557559
let uploadTask: URLSessionUploadTask
@@ -640,7 +642,7 @@ extension UploadAPI {
640642
/// - completionHandler: Completion handler.
641643
#if !os(Linux)
642644
@discardableResult
643-
internal func directUploadInForeground(
645+
public func directUploadInForeground(
644646
files: [String: Data],
645647
store: StoringBehavior? = nil,
646648
metadata: [String: String]? = nil,

Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
432432

433433
let list = try await filesList.get(withQuery: query)
434434
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
435-
XCTFail()
435+
XCTFail("No images found")
436436
return
437437
}
438438

@@ -469,7 +469,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
469469

470470
let list = try await filesList.get(withQuery: query)
471471
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
472-
XCTFail()
472+
XCTFail("No images found")
473473
return
474474
}
475475

@@ -488,7 +488,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
488488

489489
let list = try await filesList.get(withQuery: query)
490490
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
491-
XCTFail()
491+
XCTFail("No images found")
492492
return
493493
}
494494

@@ -506,7 +506,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
506506

507507
let list = try await filesList.get(withQuery: query)
508508
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
509-
XCTFail()
509+
XCTFail("No images found")
510510
return
511511
}
512512

@@ -521,7 +521,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
521521

522522
let list = try await filesList.get(withQuery: query)
523523
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
524-
XCTFail()
524+
XCTFail("No images found")
525525
return
526526
}
527527

@@ -536,7 +536,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
536536

537537
let list = try await filesList.get(withQuery: query)
538538
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
539-
XCTFail()
539+
XCTFail("No images found")
540540
return
541541
}
542542

@@ -552,7 +552,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
552552

553553
let list = try await filesList.get(withQuery: query)
554554
guard let uuid = list.results.filter({ $0.isImage }).first?.uuid else {
555-
XCTFail()
555+
XCTFail("No images found")
556556
return
557557
}
558558

Uploadcare.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 = 'Uploadcare'
3-
s.version = '0.13.0'
3+
s.version = '0.13.1'
44
s.summary = 'Swift integration for Uploadcare'
55

66
# This description is used to generate tags and improve search results.

0 commit comments

Comments
 (0)