A Boolean value that indicates whether the request may use the network when the user has specified Low Data Mode.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Foundation
Declaration
var allowsConstrainedNetworkAccess: Bool { get set }
Discussion
In iOS 13 and later, users can set their device to use Low Data Mode as one of the Cellular Data Options in the Settings app. Users can turn on Low Data Mode to reduce your app’s network data usage. This property controls the request’s behavior when the user turns on Low Data Mode. If there are no nonconstrained network interfaces available and the request’s allows
property is false
, any connection created from the request fails. In this case, the error provided when the connection fails has a network
property whose value is NSURLError
.
Setting this property on a request overrides the allows
property of URLSession
. For example, if the session configuration’s allows
value is false
, and you create a task from a request whose allows
is true
, the task treats the value as true
.
Limit your app’s of use of constrained network access to user-initiated tasks, and put off discretionary tasks until a nonconstrained interface becomes available.