Xamarin 表单 Web 视图重定向失败



我的XamForms Web视图遇到iOS问题。我已经将 info.plist 设置为允许NSAllowsArbitraryLoads

我的网址https://myurl.co.uk//rewards.html?sso=<GUID>&cid=<ID> - 没有什么不寻常的。当我点击 Safari 作为直接链接(我输入它(时,会显示 URL。在 Xamarin 窗体视图上没有这样的运气。在这里我得到以下回溯

2019-11-21 10:28:58.626694+0000 Perks.iOS[44969:1429154] [Common] _BSMachError: port 7903; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
2019-11-21 10:28:59.295901+0000 Perks.iOS[44969:1429327] [unspecified] container_system_group_path_for_identifier: error = (container_error_t)53
2019-11-21 10:28:59.522399+0000 Perks.iOS[44969:1429169] Connection 1: received failure notification
2019-11-21 10:28:59.522545+0000 Perks.iOS[44969:1429169] Connection 1: failed to connect 12:8, reason -1
2019-11-21 10:28:59.522637+0000 Perks.iOS[44969:1429169] Connection 1: encountered error(12:8)
2019-11-21 10:28:59.523727+0000 Perks.iOS[44969:1429290] Task <D57B535F-7434-4B60-9EBF-0490B8FCF2EF>.<0> HTTP load failed, 0/0 bytes (error code: -1003 [12:8])
2019-11-21 10:28:59.523851+0000 Perks.iOS[44969:1429290] NSURLConnection finished with error - code -1003

关于导致问题的原因的任何想法?当我通过邮递员放置 URL 时,重定向页面上有一些 JS,但它并没有走那么远,所以我猜这是网络视图有问题

原因:从 iOS 9 开始,iOS 将仅允许应用程序与默认实现最佳实践安全性的服务器进行通信。必须在 Info.plist 中设置值才能启用与不安全服务器的通信。

解决方案:info.plist中添加以下代码以信任您的域。

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
      <key>myurl.co.uk</key>
      <dict>       
       <key>NSExceptionRequiresForwardSecrecy</key>
       <false/>
       <key>NSExceptionAllowsInsecureHTTPLoads</key>
       <true/>
       <key>NSIncludesSubdomains</key>
       <true/>
     </dict>
</dict>

最新更新