iOS 7中kSecTrustResultConfirm的替代方案是什么?

ope*_*rog 5 security iphone ios mknetworkkit mknetworkengine

我们的旧应用程序使用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];
          }
        }
Run Code Online (Sandbox Code Playgroud)

有更换kSecTrustResultConfirm吗?

ash*_*ack 0

如果您由于某种原因无法更新 MKNetworkKit,请查看此提交: https: //github.com/MugunthKumar/MKNetworkKit/commit/c28959805991bb8f0e99ede9c822e985b41f6fc9。您将看到kSecTrustResultConfirm条件已被完全删除,并且您应该能够执行相同的操作。