0

Hi please read the whole thing before down vote,

I have tried this solutions already, 1 ,2, 3 but still no solution,

Now my problem here is I am trying to connect app to Camera in same LAN, so URL : https://LocalIP:PORT/cam_username/cam_password, in response I should get Image, this is the code just incase for reference.

        let url = URL(string: url1)
        if url != nil
        {
        DispatchQueue.global(qos: DispatchQoS.QoSClass.default).async 
        {
            let data = try? Data(contentsOf: url!)
            if (data != nil)
            {
            DispatchQueue.main.async(execute: {                    
                let indexPath = IndexPath(row : i, section : 0)
                if let cell : CamTableViewCell = self.tableView .cellForRow(at: indexPath) as? CamTableViewCell
                {

                    cell.ImageLive.image = UIImage(data: data!)
                }

            });
            }
            }
        }

Response : data = nil and this message in console

[] nw_coretls_read_one_record tls_handshake_process: [-9801] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801)

EDIT : my plist contains this

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

NOTE: URL works fine and shows me Image on Browser.

niravdesai21
  • 4,818
  • 3
  • 22
  • 33
  • What do the relevant keys in your Info.plist look like? – Rob Jun 02 '17 at 06:06
  • As the URL is in the local network try `NSAllowsLocalNetworking` rather than `NSAllowsArbitraryLoadsInWebContent`. – vadian Jun 02 '17 at 06:46
  • @vadian Still didn't help me shows same error message [] nw_coretls_read_one_record tls_handshake_process: [-9801] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9801) – niravdesai21 Jun 02 '17 at 08:13
  • why did it get down vote ? If so give me answer to this problem. – niravdesai21 Jun 02 '17 at 11:05

0 Answers0