2017-09-28 4 views
2

업데이트 할 앱이 반년 된 &입니다. 그것은 statemachine로 작성되었습니다. 이제 몇 가지를 추가했지만 connectionRequest가 iOS (iOS 디버그 용으로 빌드 된)에서 작동하지 않는 것 같습니다. 나는 그것을 안드로이드에서 만들었고 아주 잘 작동합니다. 때문에 비 보안 URL http에서 데이터를 가져 오는에서 응용 프로그램을 방지 새로운 애플 규정에iOS에서 ConnectionRequest가 작동하지 않습니다.

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); 
} 
+0

URL로 인한 것입니까? API는 http & iOS에 https가 필요하다고 생각합니다. 그러나 그렇다면 이전 버전이 정상적으로 작동하는 이유는 무엇입니까? – beck

답변

1

이있을 수 있습니다. 빌드 힌트를 추가하여 일시적으로 문제를 해결할 수 있습니다.

ios.plistInject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict><key>CFBundleURLTypes</key><array><dict><key>CFBundleURLName</key><string>com.mycompany.myapp</string></dict><dict><key>CFBundleURLSchemes</key><array><string>MyApp</string></array></dict></array> 

보안되지 않은 URL에 연결되어 있으면 앱이 거부 될 수 있습니다.

+0

빌드 힌트에 추가 한 후에는 앱을 기기에 설치할 수 없습니다. "응용 프로그램을 다운로드 할 수 없음"대화 상자가 표시됩니다. – beck

+0

네트워크와 관련이 있습니다. 이전 응용 프로그램을 삭제하고 장치를 다시 시작하십시오. – Diamond

+0

여전히 동일하지 않습니다. 나는 com.mycompany.myapp를 내 패키지 이름으로 바꿨으나 prob가 존재한다. – beck

관련 문제