How to Manually set cookies to WKWebViewRenderer in Xamarin forms IOS

98 views Asked by At

I am working on Xamarin forms, I am trying to load a authenticated webview, I have Initialized Source and Cookies Properties in ViewModel. In Android its working fine, but in IOS authenticated webView is not loaded.

I tried by adding Custom WebView control with custom WkWebViewRenderer to load a WebView. I am confused on how to set Cookies Manually in WkWebViewRenderer

1

There are 1 answers

0
Zack On

In Android its working fine, but in IOS authenticated webView is not loaded.

This reason should be the ATS (App Transport Security) limitation of iOS. ATS is a security feature introduced by Apple in iOS 9. It will prevent connections that do not meet the minimum security requirements. You can add the following code in the Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoadsInWebContent</key>
  <true/>
</dict>

how to set Cookies Manually in WkWebViewRenderer

You can refer to the answer in issue: Xamarin WKWebView and Cookies.