Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

iOS 10 Stream Error

Community Beginner ,
Sep 27, 2016 Sep 27, 2016

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);

TOPICS
Performance issues
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Sep 28, 2016 Sep 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

Translate
Adobe Employee ,
Sep 27, 2016 Sep 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 27, 2016 Sep 27, 2016

I think i tested on simulator only.

Not working on ios10

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 28, 2016 Sep 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 28, 2016 Sep 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 28, 2016 Sep 28, 2016

Wow... now it works

Thank you so much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 28, 2016 Sep 28, 2016

Adobe staff really shouldn't keep posting

<key>NSAppTransportSecurity</key>

      <dict>

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

</dict>

as *the* solution for every NSAppTransportSecurity issue.

The proper solution is to only add exceptions to the domains your app is really using, not just completely disable NSAppTransportSecurity like this. This isn't why Apple added this feature just so everyone turns around and just disables it.

Completely disabling NSAppTransportSecurity should only be used in development testing or if your app actually needs to allow your users to enter arbitrary URLs like a web browser. At some point Apple will likely crack down on settings like the above when you submit to the store (if they aren't already)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 29, 2016 Sep 29, 2016
LATEST

Hi Jeffery,

We completely agree with you on the fact that we shouldn't be telling users to completely disable this security restriction. We have taken a note of this and we will be specific going forward.

Thank you so much.

-Ankit

Adobe Air Team

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines