Load Works in Android But Not in iOS
When a user opens my app, I send a simple load command to .NET code which sends back the string "WiFi Connected".
I recently published an Android app using AIR 24.0.0.180 in which that load works fine.
Then, using the same fla, I tried to publish an iOS app using AIR 24.0.0.180 for iOS. The ipa was created ok, but the load did not work.
In fact, the load also failed in 26.0.0.93 & 25.0.0.134 AIRs for iOS.
Then I jumped to AIR 18.0.0.144 for iOS and IT WORKED!
I can attempt to upload this to the Apple Store, but I would rather go with a more recent version of AIR for iOS If possible.
Please help! Here's the code:
//NOTE: Assume a textbox named WiFi_txt is on stage
Var DotNetURL:String = “Location of .NET code”
var scriptRequest:URLRequest = new URLRequest();
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();
var Action_Type:String = ""; //Needed for success & failure handlers
function database_action(actionType:String) {
Action_Type = actionType;
scriptVars = new URLVariables();
scriptVars.type = "BUTTON";
scriptVars.ActionType = actionType;
switch (actionType) {
case "CheckWiFi":
scriptVars.Dummy = 999;
break;
default:
break;
}
scriptRequest = new URLRequest();
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptRequest.url = DotNetURL;
scriptLoader = new URLLoader();
scriptLoader.dataFormat = URLLoaderDataFormat.VARIABLES; //VARIABLES or TEXT
scriptLoader.addEventListener(Event.COMPLETE, handleSuccess, false, 0, true);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleError, false, 0, true);
scriptLoader.load(scriptRequest);
}
function handleSuccess(e:Event):void
{
var variables:URLVariables = e.currentTarget.data as URLVariables;
switch (Action_Type) {
case "CheckWiFi":
if (variables.returnStr == "WiFi Connected") {
WiFi_txt.text = "A WiFi Connection Exists!";
}
break;
default:
break;
}
preloader.visible = false;
scriptLoader.removeEventListener(Event.COMPLETE, handleSuccess);
scriptLoader.removeEventListener(IOErrorEvent.IO_ERROR, handleError);
scriptLoader = null;
}
function handleError(e:IOErrorEvent):void
{
scriptLoader.removeEventListener(Event.COMPLETE, handleSuccess);
scriptLoader.removeEventListener(IOErrorEvent.IO_ERROR, handleError);
scriptLoader = null;
switch (Action_Type) {
case "CheckWiFi":
WiFi_txt.text = "IOError!";
break;
default:
break;
}
}
WiFi_txt.text = "A WiFi Connection is required!";
database_action("CheckWiFi");
