Skip to main content
efecomert
Participating Frequently
September 27, 2016
Answered

iOS 10 Stream Error

  • September 27, 2016
  • 2 replies
  • 1293 views

Hi,

I have an application on Appstore like 2 years.

On iOS10 my app not working. Cant connect to http links.

I debug and get error from connections:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: http://api.website.net/check.php

I used HTTPStatusEvent.HTTP_STATUS for understand any solution, it gives 0

Please help me to solve this problem.

MY CODE:

var urlReq:URLRequest = new URLRequest ("http://api.website.net/check.php");
urlReq.method = URLRequestMethod.POST;
var urlVars:URLVariables = new URLVariables();
urlVars.user_id = Main.instance.userID;

urlReq.data = urlVars; 

var loader:URLLoader = new URLLoader (urlReq);

loader.addEventListener(Event.COMPLETE, onCreditComplete);

loader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpStatusHandler);

loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

loader.dataFormat = URLLoaderDataFormat.VARIABLES;

loader.load(urlReq);

This topic has been closed for replies.
Correct answer deesharm

Hi Efe,

I tried running the sample fla project that you shared with me on DropBox.

We investigated it further and figured out that your app.xml file doesn't contain the below tags that is required to allow streaming of http URL's on iOS:

Please add below tags under <InfoAdditions> tag

<key>NSAppTransportSecurity</key>

      <dict>

      <key>NSAllowsArbitraryLoads</key><true/>

      </dict>

I tested it at my end and now it works fine both on iOS9 and iOS 10.

Dropbox - test-app.xml

Thanks,

Adobe AIR Team

2 replies

efecomert
efecomertAuthor
Participating Frequently
September 28, 2016

I found errors about server requirements.

Found a https link to try and that work. But my http link not working.

Some forums says iPv6 must supported on your server.

Do you know which requirements need to work with iOS10?

deesharm
Adobe Employee
deesharmCorrect answer
Adobe Employee
September 28, 2016

Hi Efe,

I tried running the sample fla project that you shared with me on DropBox.

We investigated it further and figured out that your app.xml file doesn't contain the below tags that is required to allow streaming of http URL's on iOS:

Please add below tags under <InfoAdditions> tag

<key>NSAppTransportSecurity</key>

      <dict>

      <key>NSAllowsArbitraryLoads</key><true/>

      </dict>

I tested it at my end and now it works fine both on iOS9 and iOS 10.

Dropbox - test-app.xml

Thanks,

Adobe AIR Team

efecomert
efecomertAuthor
Participating Frequently
September 28, 2016

Wow... now it works

Thank you so much

deesharm
Adobe Employee
Adobe Employee
September 27, 2016

Hi Efe,

I made some changes in your code snippet and running it both on iOS 9 and iOS 10. Please refer to below code snippet:

public class URLLoader_loadExample extends Sprite {

  public var loader:URLLoader;

  public function URLLoader_loadExample() {

  loader = new URLLoader();

  configureListeners(loader);

  var request:URLRequest;

  request = new URLRequest("http://api.website.net/check.php");

  request.method = URLRequestMethod.POST;

  var urlVars:URLVariables = new URLVariables();

  //urlVars.user_id = Main.instance.userID;

  request.data = urlVars;

  try {

  loader.dataFormat = URLLoaderDataFormat.TEXT;

  loader.load(request);

  } catch (error:Error) {

  trace("Unable to load requested document.");

  }

  }

  private function configureListeners(dispatcher:IEventDispatcher):void {

  dispatcher.addEventListener(Event.COMPLETE, completeHandler);

  dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);

  dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

  }

  private function completeHandler(event:Event):void {

  var loader:URLLoader = URLLoader(event.target);

  trace("completeHandler: ");

  trace(event.target.data);

  }

You are using URLLoaderDataFormat.VARIABLES that requires name/values pair to be returned from your php file. When I changed it to loader.dataFormat = URLLoaderDataFormat.TEXT; it works fine both on iOS 9 and iOS 10 and successfully getting completed without any error.

Thanks,

Adobe AIR Team

efecomert
efecomertAuthor
Participating Frequently
September 27, 2016

I think i tested on simulator only.

Not working on ios10