Instance Property


A Boolean value that indicates whether connections may use a network interface that the system considers expensive.


@property BOOL allowsExpensiveNetworkAccess;


The system determines what constitutes “expensive” based on the nature of the network interface and other factors. iOS 13 considers most cellular networks and personal hotspots expensive. If there are no nonexpensive network interfaces available and the session’s allowsExpensiveNetworkAccess property is NO, any task created from the session fails. In this case, the error provided when the task fails has a networkUnavailableReason property whose value is NSURLErrorNetworkUnavailableReasonExpensive.

Limit your app’s of use of expensive network access to user-initiated tasks, and put off discretionary tasks until an nonexpensive interface becomes available. To do this, set allowsExpensiveNetworkAccess (and allowsConstrainedNetworkAccess) to NO and waitsForConnectivity to YES. This way, your NSURLSessionTask waits for a suitable interface to become available before sending or receiving data.

See Also

Supporting Limited Modes


A Boolean value that indicates whether connections may use the network when the user has specified Low Data Mode.