iOS开发-App Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法

今天写一个demo,关于iOS和JS交互开发中学习中,因为没有学过js,html也真是懂片面,调试时遇到下问题,Xcode提示如下:

“App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary exceptions can be configured via your app's Info.plistfile.”

也就是说ATS禁止了HTTP的明文传输,因为它不安全。可以修改Info.plist文件,让它临时允许明文传输。

所以解决办法就是在Info.plist文件中添加"App Transport SecuritySettings", Type为"Dictionary",再添加"Allow Arbitray Loads", Type 为"Boolean",“Value”为“YES” 就可以了。

你可能感兴趣的:(iOS开发-App Transport Security has blocked a cleartext HTTP (http://) resource load的解决办法)