Property List Key

NSAllowsLocalNetworking

A Boolean value indicating whether to allow loading of local resources.

Details

Type
boolean

Attributes

Default: NO

Discussion

In iOS 9 and macOS 10.11, App Transport Security (ATS) disallows connections to unqualified domains, .local domains, and IP addresses. You can add exceptions for unqualified domains and .local domains in the NSExceptionDomains dictionary, but you can’t add numerical IP addresses. Instead you use NSAllowsArbitraryLoads when you want to load directly from an IP address.

In iOS 10 and macOS 10.12 and later, ATS allows all three of these connections by default, so you no longer need an exception for any of them. However, if you need to maintain compatibility with older versions of the OS, set both of the NSAllowsArbitraryLoads and NSAllowsLocalNetworking keys to YES.

The local networking exception tells newer versions of the OS—which already allow unqualified domains, .local domains, and IP addresses—to ignore the arbitrary loads key. Meanwhile, the arbitrary loads key tells older versions of the OS, which don’t process the local networking exception key, to bypass ATS completely. This allows your app to work on different OS versions while minimizing the use of the wider exception. For more information about how global ATS exceptions interact across OS versions, see Versioning.

See Also

Global Exceptions

property list key NSAllowsArbitraryLoads

A Boolean value indicating whether App Transport Security restrictions are disabled for all network connections.

Name: Allow Arbitrary Loads
property list key NSAllowsArbitraryLoadsForMedia

A Boolean value indicating whether all App Transport Security restrictions are disabled for requests made using the AV Foundation framework.

property list key NSAllowsArbitraryLoadsInWebContent

A Boolean value indicating whether all App Transport Security restrictions are disabled for requests made from web views.

Name: Allow Arbitrary Loads in Web Content