Sample code for 30+ languages & platforms
Objective-C Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat Objective-C Downloads

Objective-C
#import <CkoJsonObject.h>
#import <CkoFormats.h>

BOOL success = NO;

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

CkoJsonObject *json = [[CkoJsonObject alloc] init];
CkoFormats *fmt = [[CkoFormats alloc] init];
CkoJsonObject *jsonOut = [[CkoJsonObject alloc] init];
success = [fmt QrCode: @"capabilities" jsonIn: json jsonOut: jsonOut];
if (success == NO) {
    NSLog(@"%@",fmt.LastErrorText);
    return;
}

NSLog(@"%@%@",@"Chilkat version: ",[jsonOut StringOf: @"productVersion"]);
NSLog(@"%@%@",@"symbology: ",[jsonOut StringOf: @"symbologies[0].id"]);
NSLog(@"%@%d%@%d",@"QR versions: ",[[jsonOut IntOf: @"symbologies[0].encoding.version.min"] intValue],@" to ",[[jsonOut IntOf: @"symbologies[0].encoding.version.max"] intValue]);
NSLog(@"%@%d",@"structured append, most symbols: ",[[jsonOut IntOf: @"symbologies[0].structuredAppend.maxSymbols"] intValue]);

int i;
int n;
n = [[jsonOut SizeOfArray: @"symbologies[0].encoding.errorCorrection"] intValue];
for (i = 0; i <= n - 1; i++) {
    jsonOut.I = [NSNumber numberWithInt: i];
    NSLog(@"%@%@",@"error correction: ",[jsonOut StringOf: @"symbologies[0].encoding.errorCorrection[i]"]);
}

//  The operations this version implements.
n = [[jsonOut SizeOfArray: @"operations"] intValue];
for (i = 0; i <= n - 1; i++) {
    jsonOut.I = [NSNumber numberWithInt: i];
    if ([jsonOut BoolOf: @"operations[i].available"] == YES) {
        NSLog(@"%@%@",@"operation: ",[jsonOut StringOf: @"operations[i].name"]);
    }

}

n = [[jsonOut SizeOfArray: @"imageFormats.output"] intValue];
for (i = 0; i <= n - 1; i++) {
    jsonOut.I = [NSNumber numberWithInt: i];
    NSLog(@"%@%@",@"image format: ",[jsonOut StringOf: @"imageFormats.output[i]"]);
}

NSLog(@"%@%d%@",@"default timeout: ",[[jsonOut IntOf: @"limits.timeoutMs.default"] intValue],@" ms");
NSLog(@"%@%d%@",@"default largest image: ",[[jsonOut IntOf: @"limits.maxPixels.default"] intValue],@" pixels");

//  Sample output:

//  Chilkat version: 11.7.0
//  symbology: qr
//  QR versions: 1 to 40
//  structured append, most symbols: 16
//  error correction: auto
//  error correction: L
//  error correction: M
//  error correction: Q
//  error correction: H
//  operation: generate
//  operation: measure
//  operation: validate
//  operation: capabilities
//  image format: png
//  image format: svg
//  default timeout: 10000 ms
//  default largest image: 16777216 pixels