TLS例外。未知安全传输错误'已关闭优雅'

时间:2016-07-22 14:11:22

标签: xamarin xamarin.ios xamarin.forms

即使我的Unknown Secure Transport error 'ClosedGraceful'正在返回ServicePointManager.ServerCertificateValidationCallback,我仍然会收到此错误true

完整的堆栈跟踪是......

     at Security.Tls.AppleTlsContext.CheckStatusAndThrow (SslStatus status, Security.SslStatus[] acceptable) [0x000b1] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/AppleTlsContext.cs:170 
  at Security.Tls.AppleTlsContext.Write (System.Byte[] buffer, Int32 offset, Int32 count, System.Boolean& wantMore) [0x0003f] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/AppleTlsContext.cs:883 
  at Security.Tls.MobileAuthenticatedStream.ProcessWrite (Security.Tls.AsyncProtocolRequest asyncRequest, AsyncOperationStatus status) [0x0002f] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/MobileAuthenticatedStream.cs:637 
  at Security.Tls.AsyncProtocolRequest.ProcessOperation (AsyncOperationStatus status) [0x00086] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/AsyncProtocolRequest.cs:199 
  at Security.Tls.AsyncProtocolRequest.ProcessOperation () [0x0000d] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/AsyncProtocolRequest.cs:159 
  at Security.Tls.AsyncProtocolRequest.StartOperation () [0x00000] in /Users/builder/data/lanes/3339/39ebb778/source/maccore/src/Security/Tls/AsyncProtocolRequest.cs:140 

我甚至尝试过添加

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

info.plist,但仍然没有运气

编辑:目前正在使用RestSharp

2 个答案:

答案 0 :(得分:1)

更改属性iOS Build&gt;高级&gt;从Apple到Mono的SSL / TLS实现。

enter image description here

答案 1 :(得分:0)

接受的答案是正确的,但由于目前的视觉工作室没有这个选项,我们需要在iOSBuild下输入 mtouch argments - &gt; Code Generation&amp;运行时 - &gt;其他mtouch参数