qiniu / objc-sdk

Qiniu Resource (Cloud) Storage Objective-C SDK for Mac/iOS
http://developer.qiniu.com
MIT License
435 stars 197 forks source link

iOS9 对https的要求导致上传失败 #89

Closed roynwang closed 8 years ago

roynwang commented 8 years ago

1.Description: 上传使用的是http地址,将会导致在iOS9上上传失败。

  1. Comments: 并不想开启允许http链接的选项,添加exceptional domain后仍然失败。是否有什么workaround? Reference: http://stackoverflow.com/questions/30731785/how-do-i-load-an-http-url-with-app-transport-security-enabled-in-ios-9

以下为info.plist

NSAppTransportSecurity
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>upload.qiniu.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>

"

3.log Log如下: UserInfo={NSUnderlyingError=0x14feec9a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://101.71.78.240:80/, NSErrorFailingURLKey=http://101.71.78.240:80/, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}>

longbai commented 8 years ago

请问 是 什么版本?因为防止dns解析拦截,七牛 library 自己解析了域名,所以程序里如果您一定要用ats, 请 在configuration 里面 把 disable ats 设为 No。或者在app里 禁用整个ats

roynwang commented 8 years ago

感谢大周末的回复,辛苦了。此事不急,只是一点建议。 Qiniu 7.0.12 Xcode 7.1 deploy target: 9.0 我现在是禁用了整个ats, 但是这个目测迟早要被appstore强制要求的。个人建议最好能加个配置或者参数之类的,至少实现可选https上传。等到真的强推走https的时候减少一些麻烦。

longbai commented 8 years ago

@roynwang 已经支持https,但 我这边 在ci iOS simulator 8.1 运行失败,但本机同样版本模拟器测试正常,另外 https 直接是连到源站,性能会差点,所以目前 不推荐使用https,具体https 如何配置 单元测试有对应代码