问题很怪异:xcode运行run,打的debug包,ws(未配置ssl证书的websocket)可以正常链接;改为release模式,run,ws就直接连接失败。。。我以为要花钱买ssl证书在服务器配置呢。。。
解决:
xcode项目工程的info.plist文件增加App Transport Security Settings(Dic)、Allow Arbitrary Loads(YES)、Exception Domains(DIc)、你服务器的域名或IP(NSExceptionMinimumTLSVersion(TLSv1.0)、NSIncludesSubdomains(YES)、NSThirdPartyExceptionRequiresForwardSecrecy(NO))
设置完,release包也能正常访问ws
别问我为什么,问就是info文件对苹果ATS有影响了。