2014-09-01 86 views
0

當我在Unity3D(c#)中使用WWW時,我發現了荒謬的結果。c#unity www.text錯誤文本不在www.error

www.text的錯誤文本不在www.error中。所以我無法檢查是否發生錯誤。

  if(!string.IsNullOrEmpty (www.error)) { 
       //handling error 
       //but www.error is null 
      }else{ 
       //print www.text 
       Debug.Log(www.text); 
      } 

[打印控制檯]

  <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
      <html><head> 
      <title>503 Service Temporarily Unavailable</title> 
      </head><body> 
      <h1>Service Temporarily Unavailable</h1> 
      <p>The server is temporarily unable to service your 
      request due to maintenance downtime or capacity 
      problems. Please try again later.</p> 
      <p>Additionally, a 404 Not Found 
      error was encountered while trying to use an ErrorDocument to handle the request.</p> 
      </body></html> 

確實有人有這樣的經歷?請幫我..

+0

在if(!string.IsNullOrEmpty(www.error))行顯然插入一個斷點www。 錯誤不是null.Maybe它只包含空格 – 2014-09-01 12:44:32

回答

0

您的支票IsNullOrEmpty看起來不錯。從來沒有看到任何空白,只有空字符串或null

檢查服務器返回的HTTP代碼。用HTML表示這是錯誤代碼並不一定意味着協議錯誤是相同的。一些代理或破壞的設置可能導致這種情況。

獲取cURL並檢查錯誤代碼:

curl -v http://example.com/lipsum 

,並查找:

< HTTP/1.1 404 Not Found 

或simmilar。