Sample code for 30+ languages & platforms
Swift Requires Chilkat v11.0.0+

Transition from Email.GetSignedByCertChain to Email.LastSignerCert

Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let email = CkoEmail()!

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The GetSignedByCertChain method is deprecated:

    var certChainObj: CkoCertChain? = email.getSignedByCertChain()
    if email.lastMethodSuccess == false {
        print("\(email.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    certChainObj = nil

    //  ------------------------------------------------------------------------
    //  Do the equivalent using LastSignerCert to get the signing certificate,
    //  then build the cert chain from the signing certificate object.

    let signerCert = CkoCert()!
    success = email.lastSignerCert(index: 0, cert: signerCert)
    if success == false {
        print("\(email.lastErrorText!)")
        return
    }

    //  Get the certificate chain from the signer certificate.
    let certChain = CkoCertChain()!
    success = signerCert.buildChain(certChain: certChain)
    if success == false {
        print("\(signerCert.lastErrorText!)")
        return
    }


}