user3513902
user3513902

Reputation: 163

WKWebView not loads http image in iOS 10 and above

I am loading a https URL in WKWebView and inside that few images are coming from HTTP URL which is loading perfectly fine on enabling NSAllowsArbitraryLoads in info.plist file in iOS 9. But on iOS 10 and above it is not loading the HTTP images. I read Apple and followed all possible way but no luck.

Upvotes: 2

Views: 8395

Answers (2)

Dharma
Dharma

Reputation: 3013

Allowing Insecure Connection to a Single Server

fetching media from an insecure server use below

NSAppTransportSecurity
    NSExceptionDomains
        "media-server.example.com"
            NSExceptionAllowsInsecureHTTPLoads = YES

Apple warnings

Important: Before implementing this exception, consider that a seemingly-benign network request can cause security problems of the sort that ATS is intended to mitigate. For example, fetching media from an insecure server entails the following risks, among others: An attacker can see the media file a user is accessing Your app’s attack surface expands, for example, by allowing a bad actor to feed your app a malicious file intended to trigger a buffer overrun Avoid this connection type if possible.

The App Transport Security (ATS) keys are:

  1. NSAllowsArbitraryLoads
  2. NSAllowsArbitraryLoadsForMedia
  3. NSAllowsArbitraryLoadsInWebContent
  4. NSExceptionAllowsInsecureHTTPLoads
  5. NSExceptionMinimumTLSVersion

You can get more info from NSAppTransportSecurity

Upvotes: 0

Vignesh Davins
Vignesh Davins

Reputation: 285

Add the below line in info.plist,

NSAllowsArbitraryLoadsInWebContent

and set its value as YES

Upvotes: 1

Related Questions