HTTPS request returning 2032 Stream Error only for Android with Flex 4.6 Mobile

前端 未结 4 1764
小鲜肉
小鲜肉 2021-01-19 17:30

I have a mobile app that I targeted for iOS and Android. It makes a login request via HTTPS (using a POST with HTTPService)..Everything works fine while debugging on my dev

相关标签:
4条回答
  • 2021-01-19 18:04

    I've just experienced this issue on Android using AIR 25.0.0.134. IOS and Desktop had no issues using the same code.

    I discovered the issue was that the URL I was using had extra (invisible) characters. i.e. %A0

    The solution was to escape the url and remove all instances of %A0, then unescape and continue to download the file.

    var url:String = String(escape(ev.target.data)).replace(/%0A/gi, ""); 
    downloadThisFile(unescape(url));
    
    0 讨论(0)
  • 2021-01-19 18:11

    Different virtual flash viewers resolve errors like this differently based on the platform. Best thing to do would be to apply a bunch of error handlers and see what results.

    I'm going to quote an entire "solution" from this long-running google search result: http://www.judahfrangipane.com/blog/2007/02/15/error-2032-stream-error/

    Try listening for the HTTP_STATUS Event, then adding event handlers for all the error-types to get a more granular level of response.

    Example:

    public function doRequest(url:String = "http://www.example.com/page.php?something=whatYouWant"):void {
       var fileRequest:URLRequest = new URLRequest(url);
       var myLoader:URLLoader = new URLLoader();
    
       myLoader.addEventListener(Event.COMPLETE, onLoaderReady);
    
       myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, function(evt:Object):void{handleError(evt,"HTTPStatusEvent.HTTP_STATUS");});
       myLoader.addEventListener(IOErrorEvent.IO_ERROR, function(evt:Object):void{handleError(evt,"IOErrorEvent.IO_ERROR");});
       myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(evt:Object):void{handleError(evt,"SecurityErrorEvent.SECURITY_ERROR");});
       myLoader.load(fileRequest);
    }
    private function handleError(evt:Object , listenerType = "Anonymus"):void{
       trace('handleError listenerType '+listenerType+'\nError: '+evt);
    }
    

    Since it's Android specifically, make sure that you add the proper "permissions" for it to use the Internet, detect connections, etc. in the Manifest file:

    <android>
        <manifestAdditions><![CDATA[
        <manifest>
            <!-- See the Adobe AIR documentation for more information about setting Google Android permissions -->
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
        </manifest>
    ]]></manifestAdditions>
      </android>
    
    0 讨论(0)
  • 2021-01-19 18:16

    I was having the same problem, Stream error 2032 on https: requests, and was able to resolve it by upgrading to a newer AIR runtime. I had noticed the error occurring on one test device and not the other, the main difference being that the one with errors had AIR 3.1 installed, the one without errors had AIR 3.2.

    We are now packaging the app with captive AIR runtime (version 3.3). Since FlashBuilder came with AIR 3.1 pre-installed, it was necessary to download a new AIR SDK and overlay it on FlashBuilder.

    0 讨论(0)
  • 2021-01-19 18:19

    Very odd. Ended up having to setup a proxy to get this working.

    0 讨论(0)
提交回复
热议问题