Titanium appcelerator createHTTPClient() 不工作 Android 5.0 Lollipop
Titanium appcelerator createHTTPClient() not working Android 5.0 Lollipop
我正在用 titanium 发出一个简单的 GET 请求,在 android 5.0 及更高版本中似乎无法正常工作。这是我收到的控制台的响应。
< ANDROID 5.0
[INFO] : Status: 200, connectionType: GET
=> ANDROID 5.0
{"source":{"password":null,"status":0,"username":null,"autoRedirect":true,"bubbleParent":true,"allResponseHeaders":"","location":"","autoEncodeUrl":true,"apiName":"Ti.Network.HTTPClient","responseXML":null,"validatesSecureCertificate":false,"readyState":1,"domain":null,"responseText":"","responseData":null,"connectionType":"GET","statusText":null,"connected":false,"_events":{"disposehandle":{}}},"error":"Handshake
failed","code":-1,"success":false}
ERROR: "Handshake failed"
这是我使用的代码。
var url = "MY URL";
var loader = Titanium.Network.createHTTPClient();
loader.onload = function()
{
Titanium.API.info('Status: ' + this.status);
Titanium.API.info('ResponseText: ' + this.responseText);
Titanium.API.info('connectionType: ' + this.connectionType);
Titanium.API.info('location: ' + this.location);
};
loader.onerror = function (e) {
console.log(JSON.stringify(e));
console.log("ERROR: " + JSON.stringify(e.error));
};
loader.open("GET",url);
loader.send();
希望你能帮助我。
这是网络服务器的 SSL 证书问题。
您可以从 Chrome:
验证证书是否有效
我正在用 titanium 发出一个简单的 GET 请求,在 android 5.0 及更高版本中似乎无法正常工作。这是我收到的控制台的响应。
< ANDROID 5.0
[INFO] : Status: 200, connectionType: GET
=> ANDROID 5.0
{"source":{"password":null,"status":0,"username":null,"autoRedirect":true,"bubbleParent":true,"allResponseHeaders":"","location":"","autoEncodeUrl":true,"apiName":"Ti.Network.HTTPClient","responseXML":null,"validatesSecureCertificate":false,"readyState":1,"domain":null,"responseText":"","responseData":null,"connectionType":"GET","statusText":null,"connected":false,"_events":{"disposehandle":{}}},"error":"Handshake failed","code":-1,"success":false}
ERROR: "Handshake failed"
这是我使用的代码。
var url = "MY URL";
var loader = Titanium.Network.createHTTPClient();
loader.onload = function()
{
Titanium.API.info('Status: ' + this.status);
Titanium.API.info('ResponseText: ' + this.responseText);
Titanium.API.info('connectionType: ' + this.connectionType);
Titanium.API.info('location: ' + this.location);
};
loader.onerror = function (e) {
console.log(JSON.stringify(e));
console.log("ERROR: " + JSON.stringify(e.error));
};
loader.open("GET",url);
loader.send();
希望你能帮助我。
这是网络服务器的 SSL 证书问题。
您可以从 Chrome:
验证证书是否有效