App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure....

遇到这个问题的场景:
使用腾讯直播拉流,拉流地址是http开头的,然后一直播放不出来,在控制台查看报了这个错误。


截屏2021-11-15 下午7.47.22.png

原因 :由于打开NSAllowsArbitraryLoads的同时也打开了Allow Arbitrary Loads in Web Content,Allow Arbitrary Loads in Web Content会把NSAllowsArbitraryLoads的权限覆盖掉

解决办法:

NSAppTransportSecurity
    
        NSExceptionDomains
        
//此处填你的域名
            liteavapp.qcloud.com
            
                NSExceptionAllowInsecureHTTPLoads
                
                NSExceptionRequiresForwardSecrecy
                
                NSIncludesSubdomains
                
                NSTemporaryExceptionAllowsInsecureHTTPLoads
                
            
        
        NSAllowsArbitraryLoadsInWebContent
        
        NSAllowsArbitraryLoads
        
    

如下图所示:

截屏2021-11-15 下午7.52.22.png

你可能感兴趣的:(App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure....)