Sample code for 30+ languages & platforms
Objective-C

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat Objective-C Downloads

Objective-C
#import <CkoCert.h>
#import <CkoPublicKey.h>

BOOL success = NO;

CkoCert *cert = [[CkoCert alloc] init];

//  ------------------------------------------------------------------------
//  The ExportPublicKey method is deprecated:

CkoPublicKey *publickeyObj = [cert ExportPublicKey];
if (cert.LastMethodSuccess == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using GetPublicKey.
//  Your application creates a new, empty PublicKey object which is passed 
//  in the last argument and filled upon success.

CkoPublicKey *publickeyOut = [[CkoPublicKey alloc] init];
success = [cert GetPublicKey: publickeyOut];
if (success == NO) {
    NSLog(@"%@",cert.LastErrorText);
    return;
}