【发布时间】: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