xcode7,AFN不能使用的问题

今天手贱立刻升级了Xcode7,结果AFN报错,且不能用了,解决办法如下

第一步:升级AFN到2.6.0

完成之后,运行,结果请求都失败,提示

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

ios9只能使用https安全协议。俺们公司都是http协议的

网上找了一些资料,解决办法如下

第一步:在Info.plist中添加NSAppTransportSecurity且类型设置为Dictionary

第二步:在NSAppTransportSecurity字典中下添加NSAllowsArbitraryLoads类型Boolean,并设为YES

如图

原文地址:https://www.cnblogs.com/haojuncong/p/4818533.html