J'ai une année & une demi-application à mettre à jour. Il a été écrit dans Statemachine. Maintenant, j'ai ajouté quelques choses, mais la connectionRequest ne semble pas fonctionner dans iOS (qui a été construit pour le débogage iOS). Je l'ai construit dans Android et ça marche très bien.ConnectionRequest ne fonctionne pas dans iOS
public void connectionForLogin(String username, String password) {
ConnectionRequest cr = new ConnectionRequest() {
@Override
protected void readResponse(InputStream input) throws IOException {
JSONParser jSONParser = new JSONParser();
Map<String, Object> parsedData = jSONParser.parseJSON(new InputStreamReader(input));
ArrayList<Map<String, Object>> response = (ArrayList<Map<String, Object>>) parsedData.get("root");
if (response != null) {
for (Map<String, Object> element : response) {
success = (String) element.get("login");
msg = (String) element.get("msg");
ArrayList<Map<String, Object>> userInfoArray = (ArrayList) element.get("user_info");
Storage.getInstance().writeObject("userInfo", userInfoArray);
}
}
}
@Override
protected void postResponse() {
super.postResponse();
}
@Override
protected void handleErrorResponseCode(int code, String message) {
}
@Override
protected void handleException(Exception err) {
}
@Override
protected void handleIOException(IOException err) {
}
@Override
protected void handleRuntimeException(RuntimeException err) {
}
};
cr.setPost(true);
cr.setDuplicateSupported(true);
cr.setTimeout(30000);
AllUrl au = new AllUrl();
InfiniteProgress ip = new InfiniteProgress();
Dialog d = ip.showInifiniteBlocking();
cr.setDisposeOnCompletion(d);
cr.setUrl(http://zzz.com/api/logins/match? + "username=" + username + "&password=" + password);
NetworkManager.getInstance().addToQueueAndWait(cr);
}
Est-ce dû à url? L'API est en http et je pense que iOS nécessite https. Mais si oui, pourquoi la version précédente fonctionne-t-elle bien? – beck