【问题标题】:What's the alternative for kSecTrustResultConfirm in iOS 7?iOS 7 中 kSecTrustResultConfirm 的替代方案是什么?
【发布时间】:2013-10-12 11:41:39
【问题描述】:

我们的旧应用使用 MKNetworkKit 和 MKNetworkOperation。

现在在 iOS 7 下 kSecTrustResultConfirm 已弃用。 在 MKNetworkOperation 中有这样的代码:

 else if(result == kSecTrustResultConfirm) { // DEPRECATED

          if(self.shouldContinueWithInvalidCertificate) {

            // Cert not trusted, but user is OK with that
            DLog(@"Certificate is not trusted, but self.shouldContinueWithInvalidCertificate is YES");
            [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
          } else {

            DLog(@"Certificate is not trusted, continuing without credentials. Might result in 401 Unauthorized");
            [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
          }
        }

kSecTrustResultConfirm 有替代品吗?

【问题讨论】:

  • 同样的问题,你解决了吗?
  • 我相信你不再需要在 iOS 7 中检查这种情况,因为这个值永远不会返回。简而言之,以此为条件的代码块可以是#ifdef'd并被忽略。不过不确定。仍在尝试围绕整个 API 进行思考。

标签: iphone ios security mknetworkkit mknetworkengine


【解决方案1】:

如果您因任何原因无法更新 MKNetworkKit,请查看此提交:https://github.com/MugunthKumar/MKNetworkKit/commit/c28959805991bb8f0e99ede9c822e985b41f6fc9。您会看到 kSecTrustResultConfirm 条件已被完全删除,您应该也可以这样做。

【讨论】:

    猜你喜欢
    • 2016-10-18
    • 1970-01-01
    • 2021-11-13
    • 2018-12-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多