I am new to iOS development, and am trying to implement an SSL connection to a custom port.
I found the code from this answer as the best/easiest implementation of a secure connection over a socket https://stackoverflow.com/a/30733961/2306428
However, I am getting these errors:
Use of unresolved identifier 'kSSLClientSide'
Use of unresolved identifier 'kSSLStreamType'
Use of unresolved identifier 'kSSLSessionOptionBreakOnClientAuth'
I have checked and I am running Swift version 2.1.1, using iOS 9.2 SDK and Xcode 7.2. I have even tried adding import Security
but that has no effect.
What is the reason that these constants are not being found?
The line being tested is here: https://github.com/ksred/bank-ios/blob/master/Bank/TCPClient.swift#L209
Please use the identifiers declared in Swift:
if let sslContext = SSLCreateContext(kCFAllocatorDefault, SSLProtocolSide.ClientSide, SSLConnectionType.StreamType) {
SSLSetIOFuncs(sslContext, sslReadCallback, sslWriteCallback)
SSLSetConnection(sslContext, &socketfd)
SSLSetSessionOption(sslContext, SSLSessionOption.BreakOnClientAuth, true)
SSLHandshake(sslContext)
}