Swift iOS 9 NSURLErrorDomain Error -1004

前端 未结 1 1313
太阳男子
太阳男子 2021-01-22 01:06

I\'m using Swift 2 and Alamofire with both iOS 9 and iOS 8. In iOS 8 all my requests to my API work fine. In iOS 9 they immediately fail with a -1004 NSURLErrorDomain with the m

1条回答
  •  既然无缘
    2021-01-22 01:37

    After messing around with a ton of different keys and values to make it work, I finally have come up with this to make it function in iOS9.1:

    NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
        NSExceptionDomains
        
            mydomain.com
            
                NSIncludesSubdomains
                
                NSTemporaryExceptionAllowsInsecureHTTPLoads
                
                NSTemporaryExceptionMinimumTLSVersion
                TLSv1.1
                NSExceptionRequiresForwardSecrecy
                
                NSRequiresCertificateTransparency
                
            
        
    
    

    After I added the last one NSRequiresCertificateTransparency and set that to false it worked, so that's probably the most important one.

    0 讨论(0)
提交回复
热议问题