2016-09-02 2 views
1

을 통해 다운로드하여 iOS 및 Unity with Android 용 앱을 만듭니다.Unity iOS, https

지금은 아이폰 OS 문제에 붙어있어 :

You are using download over http. Currently unity adds `NSAllowsArbitraryLoads` to `Info.plist` to simplify transition, but it will be removed soon. Please consider updating to https. 

지원되지 않는 URL

실제 문제는 :
- I connect to an https address
- 그러나 I did set the Allow Arbitrary Loads to YES

, 그것은 작동하지 않습니다.

string GET = "mail="+mail+"&nome="+nome+"&cognome="+cognome; 
// get parameters 
WWW response = new WWW (SERVER+"adduser/?"+GET); 
// calling page, address is like 'https://website.com/' 
while (!response.isDone && response.error != "") { 
    yield return null; 
} 
if (response.error != "") { 
    print (response.error); 
    return false; 
} 

분명히, 이것은 IEnumerator 기능이며 항상 이전 오류를 반환

여기 내 코드입니다.

답변

2

Apple에서 iOS 장비의 http 연결을 허용하지 않았습니다. info.plistNSAppTransportSecurity을 추가하여 계속 http 연결을 사용할 수 있지만 나중에 제거됩니다. 지금부터 https 연결을 사용하는 것이 좋습니다. 이 문제를 해결하기 위해 UnityWebRequest이 소개되었습니다.

IEnumerator makeRequest() 
{ 
    string GET = "mail=" + mail + "&nome=" + nome + "&cognome=" + cognome; 
    UnityWebRequest www = UnityWebRequest.Get(SERVER + "adduser/?" + GET); 
    yield return www.Send(); 

    if (www.isError) 
    { 
     Debug.Log("Error while downloading: " + www.error); 
    } 
    else 
    { 
     // Show results as text 
     Debug.Log(www.downloadHandler.text); 

     // Or retrieve results as binary data 
     byte[] results = www.downloadHandler.data; 
    } 
} 
+2

대단히 감사합니다! SMH가 상황을 해결했습니다! – ZioCain

+0

@ZioCain 왜 문제가 해결 되었기 때문에 답변을 취소 했습니까? 이것이 당신의 문제를 해결했다면 대답으로 받아 들여야합니다. 그것은 고마워하는 친절한 방법입니다. 왜 그렇게했는지 설명하면 좋을 것입니다. – Programmer

+1

죄송합니다. 답변을 수락했다고 생각했는데, 그 이유는 모르겠지만 내가 실제로 동의하지 않았고 실제로 어떻게 작동하는지 아직도 이해하려고합니다. – ZioCain