[错误]The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

QQ20150917-3

升级到Xcode 7编译了新客户端,在网络请求HTTP的时候,
控制台输出:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

解决方法:到项目的info.plist中加入如图配置,或者用“文本编辑”,打开info.plist插入
[objc]
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
[/objc]
QQ20150917-4

相关帮助资料:https://github.com/ChenYilong/iOS9AdaptationTips

77 thoughts on “[错误]The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

  1. 谢勇

    你好,请问这是什么原因??
    ld: warning: ignoring file /Users/Diana/Documents/HR/IOS/HRA/HRA/openSSL/libssl.a, missing required architecture i386 in file /Users/Diana/Documents/HR/IOS/HRA/HRA/openSSL/libssl.a (2 slices)
    ld: warning: ignoring file /Users/Diana/Documents/HR/IOS/HRA/HRA/openSSL/libcrypto.a, missing required architecture i386 in file /Users/Diana/Documents/HR/IOS/HRA/HRA/openSSL/libcrypto.a (2 slices)
    Undefined symbols for architecture i386:
    “_BIO_new_mem_buf”, referenced from:
    -[LogoView test] in LogoView.o
    “_PEM_read_bio_RSA_PUBKEY”, referenced from:
    -[LogoView test] in LogoView.o
    “_RSA_public_encrypt”, referenced from:
    -[LogoView test] in LogoView.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    1. userKuma Post author

      这个一般是库的路径没对上,或者这个库不支持I386.
      1、库的路径没对上,直接以下操作:
      targets -> Build Phases -> Link Binary With Libraries 添加库
      targets -> Build Settings -> Library Search Paths 添加库路径
      2、查看库是否不支持I386,直接找到库路径,终端操作:
      lipo -info 库路径
      之后回车,如果没有出现I386,则要自己找到支持I386的库。

Cobxxf进行回复 取消回复

电子邮件地址不会被公开。