Objective-C
Objective-C
Transition from Email.GetSignedByCertChain to Email.LastSignerCert
Provides instructions for replacing deprecated GetSignedByCertChain method calls with LastSignerCert.Chilkat Objective-C Downloads
#import <CkoEmail.h>
#import <CkoCertChain.h>
#import <CkoCert.h>
BOOL success = NO;
CkoEmail *email = [[CkoEmail alloc] init];
// ...
// ...
// ------------------------------------------------------------------------
// The GetSignedByCertChain method is deprecated:
CkoCertChain *certChainObj = [email GetSignedByCertChain];
if (email.LastMethodSuccess == NO) {
NSLog(@"%@",email.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using LastSignerCert to get the signing certificate,
// then build the cert chain from the signing certificate object.
CkoCert *signerCert = [[CkoCert alloc] init];
success = [email LastSignerCert: [NSNumber numberWithInt: 0] cert: signerCert];
if (success == NO) {
NSLog(@"%@",email.LastErrorText);
return;
}
// Get the certificate chain from the signer certificate.
CkoCertChain *certChain = [[CkoCertChain alloc] init];
success = [signerCert BuildCertChain: certChain];
if (success == NO) {
NSLog(@"%@",signerCert.LastErrorText);
return;
}