I'm having trouble trying to convert the code I found in the Apple documentation into quick code. To be precise, this is information about TSL and certificates ...
https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html
This is the source code in Objective-C.
SecTrustResultType secresult = kSecTrustResultInvalid; if (SecTrustEvaluate(trust, &secresult) != errSecSuccess) return; }
And this is my attempt ...
var secresult:SecTrustResultType = kSecTrustResultInvalid // ERROR 1 if (SecTrustEvaluate(trust, &secresult) != errSecSuccess) { // ERROR 2 return; }
ERROR 1:
'Int' is not convertible to 'SecTrustResultType'
ERROR 2:
Could not find an overload for '!=' that accepts the supplied arguments
Now I see that SecTrustResultType is UInt32 and kSecTrustResultInvalid is Int ... but this header is defined by Apple, so I suppose it should be correct: P
typealias SecTrustResultType = UInt32 var kSecTrustResultInvalid: Int { get }
About the second error, I really do not know how to manage it, because the SecTrustEvaluate function returns OSStatus (this is an alias for UInt32 ), and errSecSuccess is OSStatus .
I'm really confused. Do you have any suggestions for creating this material ??
source share