Skip to content

Commit 9de78c0

Browse files
committed
URLSessionConfiguration.background() method marked as unavailable since it only supported by Darwin infrastructure.
1 parent 0d23a4e commit 9de78c0

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

Foundation/URLSession/URLSessionConfiguration.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,8 @@ open class URLSessionConfiguration : NSObject, NSCopying {
156156
return ephemeralConfiguration
157157
}
158158

159-
open class func background(withIdentifier identifier: String) -> URLSessionConfiguration {
160-
if identifier.isEmpty {
161-
// As per document: The unique identifier for the configuration object. This parameter must not be nil or an empty string.
162-
// But it is unclear what happens when it is empty, the existing Foundation framework creates an instance anyway.
163-
// FIXME: Handle empty string properly
164-
}
165-
let backgroundConfiguration = URLSessionConfiguration.default.copy() as! URLSessionConfiguration
166-
backgroundConfiguration.identifier = identifier
167-
backgroundConfiguration.urlCache = nil
168-
return backgroundConfiguration
169-
}
159+
@available(*, unavailable, message: "Not available on non-Darwin platforms")
160+
open class func background(withIdentifier identifier: String) -> URLSessionConfiguration { NSUnsupported() }
170161

171162
/* identifier for the background session configuration */
172163
open var identifier: String?

0 commit comments

Comments
 (0)