Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve Xcode 15 network runtime warning (#129) #130

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Uploadcare/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 4 additions & 2 deletions Sources/Uploadcare/UploadAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,16 @@ 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
let localURL = tempDir.appendingPathComponent(UUID().uuidString)

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
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 7 additions & 7 deletions Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion Uploadcare.podspec
Original file line number Diff line number Diff line change
@@ -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.
Expand Down