We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
URLSession delegate method urlSession(_:task:didFinishCollecting:) is not invoked on Linux platform.
urlSession(_:task:didFinishCollecting:)
Given the following code snippet, the program will hang forever, since the didFinishCollecting delegate method is not called.
didFinishCollecting
import Foundation import FoundationNetworking let group = DispatchGroup() group.enter() class URLSessionClient: NSObject { private lazy var session: URLSession = { let session = URLSession(configuration: .default, delegate: self, delegateQueue: nil) return session }() func start() { let url = URL(string: "https://www.apple.com") var request = URLRequest(url: url!) request.httpMethod = "GET" let dataTask = session.downloadTask(with: request) dataTask.resume() } } extension URLSessionClient: URLSessionDelegate, URLSessionDataDelegate, URLSessionTaskDelegate { func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: (any Error)?) { print("Complete") } func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { guard let metric = metrics.transactionMetrics.last else { print("No metric collected. Exit") return } group.leave() print("Metric: \(metric)") } } DispatchQueue.global().async { let client = URLSessionClient() client.start() } group.wait()
Ubuntu 22.04.4 LTS
Swift version 5.10.1 (swift-5.10.1-RELEASE) Target: x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered:
No branches or pull requests
URLSession delegate method
urlSession(_:task:didFinishCollecting:)
is not invoked on Linux platform.Steps to reproduce:
Given the following code snippet, the program will hang forever, since the
didFinishCollecting
delegate method is not called.Platform
Ubuntu 22.04.4 LTS
Swift version
Swift version 5.10.1 (swift-5.10.1-RELEASE)
Target: x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered: