Hey,
I have data being sent to a php file that works fine in the XCode Simulator and when XCode runs it through my iphone (data is received in the php file and stored in a database), but when I actually install the app through HockeyApp onto the phone, the data never reaches the php file. I just want to make sure this isn’t heard of or known as a bug in OpenFL? My code is here:
class PHPSender extends flash.events.EventDispatcher
{
private var _urlLoader:URLLoader;
private var _urlRequest:URLRequest;
private var _urlVariables:URLVariables;
private var _retrieve:Bool;
private var _response:String;
public static var RECEIVED_PHP_DATA:String = “receivedPHPData”;
public static var RESPONSE:String = “response”;
public function new(filePath:String = "http://xxxx.com/app/game/save_game") { super(); _urlLoader = new URLLoader(); _urlVariables = new URLVariables(); _urlLoader.dataFormat = URLLoaderDataFormat.TEXT; _urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, status); _urlLoader.addEventListener(flash.events.IOErrorEvent.IO_ERROR, error); _urlLoader.addEventListener(flash.events.Event.COMPLETE, complete); trace("fiiiile path", filePath); if (filePath != null) _urlRequest = new URLRequest(filePath);
}
public function setFilePath(filePath:String):Void { _urlRequest = new URLRequest(filePath); }
public function sendToPHP(content:String):Void { var varString:String = content; trace(varString); _urlRequest.data = varString;//_urlVariables;
_urlRequest.method = URLRequestMethod.POST; try { _urlLoader.load(_urlRequest); } catch(e:flash.events.Event) { trace("error",e); }
}
private function error(e:flash.events.IOErrorEvent):Void { _response = "FAIL:"+e.toString(); dispatchEvent(new CustomEvent(RESPONSE,_response)); trace(e); }
private function complete(e:flash.events.Event):Void { //_response = "PASS:"+e.toString(); _response = e.currentTarget.data; trace("complete", e.currentTarget.data); dispatchEvent(new CustomEvent(RESPONSE,_response)); dispatchEvent(new com.michaelgreenhut.CustomEvent(RECEIVED_PHP_DATA,e.currentTarget.data));
}
private function status(e:HTTPStatusEvent):Void { trace("he", e.responseHeaders);
}