Fla*_*esi 0 air adobe actionscript-3 animate-cc ios10
我在Appstore上有一个应用程序,比如2年.我用Adobe AIR开发.
在iOS10上我的应用程序无法运行.无法连接到http链接.
我调试并从连接中获取错误:错误#2044:未处理的ioError:text =错误#2032:流错误.网址:http://api.website.net/check.php
我使用HTTPStatusEvent.HTTP_STATUS来理解任何解决方案,它给出0
有什么方法可以解决?
我的代码:
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);
Run Code Online (Sandbox Code Playgroud)
听起来它与iOS App Transport安全设置有关.
要启用http请求,您需要在应用程序描述符中将域定义为异常:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>api.website.net</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
Run Code Online (Sandbox Code Playgroud)
或添加全局忽略安全设置:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Run Code Online (Sandbox Code Playgroud)
应将这些设置添加到InfoAdditions应用程序描述符的iPhone设置中的节点:
<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<!-- Add the above settings here -->
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
<Entitlements>
<![CDATA[
]]>
</Entitlements>
</iPhone>
Run Code Online (Sandbox Code Playgroud)