iOS App Transport Security和Instagram Media CDN

时间:2015-08-01 14:49:25

标签: ios instagram-api akamai app-transport-security

我正在更新我的iOS应用程序,从Instagram for iOS v [编辑]中提取图像。有一项新功能可以加强网络安全性。我只是通过以下NSError来获取Instagram内容:

Description: {
    NSErrorFailingURLKey = "https:/instagram.com/p/52A5mtpurv/media/?size=l";
    NSErrorFailingURLStringKey = "https:/instagram.com/p/52A5mtpurv/media/?size=l";
    NSLocalizedDescription = "An SSL error has occurred and a secure connection to the server cannot be made.";
    NSLocalizedRecoverySuggestion = "Would you like to connect to the server anyway?";
    NSURLErrorFailingURLPeerTrustErrorKey = "<SecTrustRef: 0x17b1ebe0>";
    NSUnderlyingError = "Error Domain=kCFErrorDomainCFNetwork Code=-1200 \"An SSL error has occurred and a secure connection to the server cannot be made.\" UserInfo={NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamPropertySSLClientCertificateState=0, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x17b1ebe0>, _kCFStreamErrorDomainKey=3, NSErrorFailingURLStringKey=https://igcdn-photos-f-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-15/11375272_1120995804579077_1215796842_n.jpg, NSErrorFailingURLKey=https://igcdn-photos-f-a.akamaihd.net/hphotos-ak-xaf1/t51.2885-15/11375272_1120995804579077_1215796842_n.jpg}";
    "_kCFStreamErrorCodeKey" = "-9802";
    "_kCFStreamErrorDomainKey" = 3;
}

简单的答案是禁用新的安全功能。许多人显然采取这种方法。我认为这是不明智的。

阅读上述错误,很明显Akamai CDN({1}}和Instagram正在合并以表明问题。

我在akamaihd.net

中进行了以下异常声明
info.plist

上述例外情况并非如此。有关如何进行的任何想法?同样,禁用新的安全功能并不能解决处理通过CDN运行的公共服务的问题。

2 个答案:

答案 0 :(得分:3)

问题是我的代码中有一个积极的斜线缩减器。它将https://折叠为https:/。这导致了错误。

答案 1 :(得分:0)

对我来说,这对完美无缺:

        <key>instagram.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>