2017-04-03 111 views
0

我正在構建xamarin.forms應用程序,我打算在web視圖(iOS)中加載asp.net mvc應用程序。這是我的代碼。Xamarin Webview無法正常工作

WebView webview = new WebView(); 
    webview.Source = new UrlWebViewSource 
     { 
      Url = "https://hrworksplus.com/test/test.html" 
     }; 
     MainPage = new ContentPage 
     { 
      Content = webview 
     }; 

當我把我的應用程序的URL,模擬器不加載任何東西,但如果我給google.com的鏈接,在正確的工作完全正常了。任何想法會是什麼問題,我的web應用程序在瀏覽器中工作。

問候 TA

+2

仔細檢查輸出日誌,看看是否有任何錯誤(沒有足夠的)安全連接。爲了驗證,把它放在你的'info.plist'文件中; ' NSAppTransportSecurity \t NSAllowsArbitraryLoads \t '。如果它加載,那麼您的站點SSL連接出現問題。 –

回答

1

在文件的info.plist的變化:

<key>NSAppTransportSecurity</key> 
<dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> 

解決我的問題,以發揮HTML5視頻在iOS設備上xamarin.forms網頁視圖。 像Gerald Versluis說的那樣,它會在調試控制檯中發生關於不安全連接的錯誤消息,而視頻不會播放。