Objective-C
Objective-C
Get Contents of File as Base64
See more Encryption Examples
Demonstrates how to read the contents of a file and convert to a base64 string.Chilkat Objective-C Downloads
#import <CkoBinData.h>
BOOL success = NO;
CkoBinData *bd = [[CkoBinData alloc] init];
success = [bd LoadFile: @"qa_data/jpg/starfish.jpg"];
if (success == NO) {
NSLog(@"%@",@"Failed to load file.");
return;
}
NSLog(@"%@",[bd GetEncoded: @"base64"]);
// If you want mult-line base64:
NSLog(@"%@",@"--");
NSLog(@"%@",[bd GetEncoded: @"base64_mime"]);
// If you want hex..
NSLog(@"%@",@"--");
NSLog(@"%@",[bd GetEncoded: @"hex"]);
// etc..