sendToURL - Security has blocked a cleartext HTTP

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sendToURL - Security has blocked a cleartext HTTP

npem
I am testing some code which calls localhost server as:
*                        var url:String = "http://localhost:3001";
                        var request:URLRequest = new URLRequest(url);
                        sendToURL(request);*

However, when this code (in the simulator) is run, I get an error:
/*App Transport Security has blocked a cleartext HTTP (http://) resource
load since it is insecure. Temporary exceptions can be configured via your
app's Info.plist file*.

I have entered (in the app.xml file):
        <key>NSAppTransportSecurity</key>
        <dict>
         
          <key>NSAllowsArbitraryLoads</key>
              <true/>
          <key>NSIncludesSubdomains</key>
          <true/>
        </dict>

Although Not quite sure where it needs to be, as I am not specifically using
an Apple device?

Code works fine via *navigateToURL* (but I don't want to open a Browser)

I am running:
  Flex 4.16.1
  Air 29
  and IntelliJ

Help would be appreciated

TIA, Phil




--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: sendToURL - Security has blocked a cleartext HTTP

npem
OK, I changed tack with this, as follows:

*<fx:Declarations>
    <mx:HTTPService id="service" resultFormat="text"
                    url="http://127.0.0.1:3001/blockchain"
                    result="onJSONLoad(event)" />
</fx:Declarations>


private function creationCompleteHandler(event:FlexEvent):void
{
    service.send();
}

private function onJSONLoad(event:ResultEvent):void
{
    //get the raw JSON data and cast to String
    var rawData:String = String(event.result);
    trace("RAWDATA = " + rawData);
}

*
Which returns the JSON data as a String




--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/