1

I got a Error Message When I use NSURLSession to connect a web Service with a https connection (Xcode 7.1)

the error message is following~

Error Domain=kCFErrorDomainCFNetwork Code=310 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 310.)" UserInfo=0x7fcaf4807260 {_kCFStreamErrorCodeKey=-2096, _kCFStreamErrorDomainKey=4}

But My Code is worked well with "http connection".

I use Safari to connect the web Service and Safari give me a alert like "the Certificate is invalid".

Is my problem (kCFErrorDomainCFNetwork Code=310....) come from the error SSL Certificate?

and any idea to solve the Problem?

I have set the info.plist

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

But no working~~~~

thanks in advance~

MarkHim
  • 5,686
  • 5
  • 32
  • 64
Yung-Yi
  • 21
  • 4
  • hello @Wain , I don't search the similar answer, can you give me a link to check the question is the same? – Yung-Yi Nov 03 '15 at 13:40
  • By default self signed certificates can't be verified, so you need to deal with that. Either trust the certificate on the device or add code to trust the certificate. – Wain Nov 03 '15 at 13:44

0 Answers0