Instance Property インスタンスプロパティ

allowsExpensiveNetworkAccess

A Boolean value that indicates whether connections may use a network interface that the system considers expensive. システムが高くつくと考えるネットワークインターフェイスを接続が使うかもしれないかどうかを指し示すブール値。

Declaration 宣言

var allowsExpensiveNetworkAccess: Bool { get set }

Discussion 議論

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 request’s allowsExpensiveNetworkAccess property is false, any task created from the request fails. In this case, the error provided when the task fails has a networkUnavailableReason property whose value is NSURLErrorNetworkUnavailableReason.expensive. システムは、何が “高くつく” ことを構成するかを、ネットワークインターフェイスと他の要因の本質に基づいて決定します。iOS 13は、ほとんどのセルラーネットワークと個人のホットスポットを高くつくと考えます。利用可能な高くつかないネットワークインターフェイスがないそしてリクエストのもつallowsExpensiveNetworkAccessプロパティがfalseならば、リクエストから作成されたあらゆるタスクは失敗します。この場合には、タスクが失敗する時に提供されたエラーは、networkUnavailableReasonプロパティを持ちます、それの値はNSURLErrorNetworkUnavailableReason.expensiveです。

Setting this property on a request overrides the allowsExpensiveNetworkAccess property of URLSessionConfiguration. For example, if the session configuration’s allowsExpensiveNetworkAccess value is false, and you create a task from a request whose allowsExpensiveNetworkAccess is true, the task treats the value as true. このプロパティをリクエスト上で設定することは、URLSessionConfigurationallowsExpensiveNetworkAccessプロパティをオーバーライドします。例えば、セッション構成設定のもつallowsExpensiveNetworkAccess値がfalse、そしてあなたがタスクをそれのallowsExpensiveNetworkAccesstrueであるリクエストから作成するならば、タスクは値をtrueとみなします。

Limit your app’s of use of expensive network access to user-initiated tasks, and put off discretionary tasks until a nonexpensive interface becomes available. 高くつくネットワークアクセスのあなたのアプリの利用をユーザ着手のタスクに制限してください、そして高くつかないインターフェイスが利用可能になるまで自由裁量のタスクを延期してください。

See Also 参照

Supporting Limited Modes 制限モードをサポートする