今天升级Xcode 7.0 bata
发现网络访问失败。
输出错误信息
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
Google后查证,iOS9引入了新特性App Transport Security (ATS)
。详情:App Transport Security (ATS)
新特性要求App内访问的网络必须使用HTTPS
协议。
但是现在公司的项目使用的是HTTP
协议,使用私有加密方式保证数据安全。现在也不能马上改成HTTPS
协议传输。
最终找到以下解决办法:
-
在Info.plist中添加
NSAppTransportSecurity
类型Dictionary
。 -
在
NSAppTransportSecurity
下添加NSAllowsArbitraryLoads
类型Boolean
,值设为YES
看到很多同学修改后还是不能用添加一下截图:
-
在Filter中搜索
Info.plist
,选择Info.plist
进行编辑 -
按照上面提到的方式添加信息,正确的修改会看到下图这个样子,注意类型
NSAppTransportSecurity
为Dictionary
,NSAllowsArbitraryLoads
为Boolean
,复制粘贴的时候,不要多了空格,segment fault 页面上直接复制,经常会多一个出空格! -
注意⚠️,单元测试下面也有一个
Info.plist
,修改那个文件是没有作用的!
补充说明
上面介绍的方法虽然解决了网络访问的问题,但是苹果提供的安全保障也被关闭了。
不过,按照国内的现状,关闭这个限制也许是更实际的做法。
至于原因就太多了,第三方SDK(几乎都是访问HTTP
),合作伙伴接入(不能要求它们一定要支持HTTPS)。
如果你的App没有受到这些原因的限制,还是更建议你增加HTTPS
支持,而不是关闭限制。
请大家根据项目的实际情况作调整。
出于安全考虑我们提倡使用HTTPS
,退而求其次,优先考虑使用例外
:将允许访问的域加入到配置列表中
@banxi1988 补充了配置的方法
对于实在不支持HTTPS
的应该首先考虑添加例外
添加例外的方式也很简单:
左键Info.plist
选择open with source code
然后添加类似如下的配置:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>qq.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
<key>sina.com.cn</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
</dict>
</dict>
</dict>
根据自己需要的域名修改, NSIncludeSubdomains 顾名思义是包括子域的意思。
相关推荐
xcode7_mexopts.zip
关于xcode7真机测试出现 could not find developer disk image 问题,主要缺少了此文件夹,将其放到 /Applications/Xcode7.0.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 目录下就OK了.
Step up your iOS development with the power and wealth of features of Xcode 7 About This Book Updated for the latest Xcode 7 release, this is the first book that will show you how to use all the new...
看了WWDC15中what’s new in XCode后,忍不住想试试XCode中UITest,http://blog.csdn.net/lcg0412/article/details/46540943博客的Demo代码
这个文件可以让你在Xcode7版本调试iOS10.1版本的真机(Could not find Developer Disk Image)。将压缩包解压把文件夹放在 /Applications/Xcode.app/Contents/Developer/ 即可。
xcode7 空工程Empty-Application
ios xcode10-xcode14各版本sdk,主要包括7 8 9 10 11 12 13 14个版本以及各小版本,博客中有截图。
XCode下载
Xcode 7 Essentials(2nd) 英文无水印pdf 第2版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传...
xcode_6_beta_7.dmg下载百度云地址
xcode_4.2.1_for_lion 文件大小:1.69G xcode_4.1_for_lion 文件大小:2.96G xcode_3.2.6_and_ios_sdk_4.3__final 文件大小:4.14G 2012年1月上传,亲自测试可以下载。 ================================
升级iOS10后,Xcode运行程序到真机报错,提示Could not ...从xcode8 beta6里提取的iOS10 beta7的DeveloperDiskImage 放置路径 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
卸载xcode的命令
xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键xcode快捷键
查找Xcode无用代码
Finder:shift + command + G /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 将包放入该目录下验证密码,并重启Xcode, 就可以运行15.6系统的真机
xcode oc代码混淆
Xcode Empty Application模板
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/10.1
xcode4.0.2sdk4.3 xcode4.0.2sdk4.3 xcode4.0.2sdk4.3xcode4.0.2sdk4.3