为什么我看到有关 'data(for:delegate:) is only available on iOS 15.0+' 的错误,即使现代并发是向后兼容的

Why do I see an error about 'data(for:delegate:) is only available on iOS 15.0+' even though modern concurrency is backward compatible

Async / Await 的现代并发在 iOS 15 及更高版本 Swift 5.5 中引入,但很快,随着 Xcode 13.2 的发布(随后13.2.1) 它使我们能够使用 AsyncAwait 为 iOS 13+、macOS 10.15+ 等开发。但是,当我尝试发出这样的异步请求时:

let (data, response) = try await URLSession.shared.data(for: request)

它不会 运行 iOS 13+。相反,我收到一条错误消息:

data(for:delegate:) is only available in iOS 15.0 or newer

当我将最低部署目标设置为 iOS 15.0 时错误消失,但我希望软件支持 iOS 13.0+。我知道 data(for:delegate:) 仅在 iOS 15.0+ 上受支持,但是如果我无法发出异步网络获取请求,向后兼容 13.0+ 的意义何在?

this Swift by Sundell article所述:

Although Swift 5.5’s new concurrency system is becoming backward compatible in Xcode 13.2, some of the built-in system APIs that make use of these new concurrency features are still only available on iOS 15, macOS Monterey, and the rest of Apple’s 2021 operating systems.

这是 John 为一种方法复制 async/await-powered URLSession API 的方式:

@available(iOS, deprecated: 15.0, message: "Use the built-in API instead")
extension URLSession {
    func data(from url: URL) async throws -> (Data, URLResponse) {
         try await withCheckedThrowingContinuation { continuation in
            let task = self.dataTask(with: url) { data, response, error in
                 guard let data = data, let response = response else {
                     let error = error ?? URLError(.badServerResponse)
                     return continuation.resume(throwing: error)
                 }

                 continuation.resume(returning: (data, response))
             }

             task.resume()
        }
    }
}