▶hlongvu

NSAllowsArbitraryLoads Not Work Try This

When dealing with insecure Http API, for a long time NSAllowsArbitraryLoads working fine for me. But today it still appears on my bug. Why am I still got NSURLConnection finished with error - code -1022 when already set NSAllowsArbitraryLoads to true.

Searching around, I found out this setting got overridden by other ‘similar’ settings.

By specifying NSAllowsArbitraryLoadsInWebContent, you are overriding NSAllowsArbitraryLoads on iOS 10.

In iOS 10 and later, and macOS 10.12 and later, the value of [the NSAllowsArbitraryLoads] key is ignored if any of the following keys are present in your app's Info.plist file:

NSAllowsArbitraryLoadsForMedia
NSAllowsArbitraryLoadsInWebContent
NSAllowsLocalNetworking

So, simply remove any additional key on your plist will make your Http request work again!