1

I used the Codename One framework to develop an iOS app (it's not a native iOS app).

I used a BrowserComponent to show a website on my iOS app. I tested it on an iPhone 7 Plus (iOS version 11.2.5) and I noticed that only HTTPS websites are shown. If i put a HTTP url, the BrowserComponent is blank.

Is there any build hint to set in order to show HTTP websites?

A M
  • 831
  • 1
  • 14
  • 26
  • 1
    Possible duplicate of [Transport security has blocked a cleartext HTTP](https://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http) – Pranavan SP Feb 20 '18 at 10:49
  • 2
    @PranavanSp it's not a duplicate as the application of this to Codename One isn't covered there. The answer below is correct but notice that on app submission review Apple will ask for a good reason you have for requiring that hint – Shai Almog Feb 21 '18 at 04:35
  • @Shai, is there another way to achieve the result? I only have to show a HTTP website. – A M Feb 21 '18 at 07:45
  • 1
    No. This is a restriction from Apple as they want all of your communication on https. If you don't do that you need to ask them (which is what this flag is effectively doing) and then explain to them why you made that request. Whether they accept your explanation is up to them but they might require things like a notification to the user that data is transmitted in an insecure way or something like that. – Shai Almog Feb 22 '18 at 03:38
  • Thank you, Shai. – A M Feb 22 '18 at 08:31

1 Answers1

2

iOS apps block HTTP requests by default. As this blog post suggests, you should inject NSAllowsArbitraryLoads with the value true to your app's Info.plist:

ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict>
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223