Skip to main content

AilaScanObject

Base object representing a scanned barcode.

Declaration

@interface AilaScanObject : NSObject
@property (nonatomic) AilaCodeType type;
@property (nonatomic) NSString *data;
- (NSString *)typeDescription;
@end

Description

This object is returned as part of the scanCallback upon a successful scan, and contains the type and data of the scan.

Properties

type

An enum representing the barcode symbology.

Type: AilaCodeType

Example values: AilaCodeTypeQR, AilaCodeType128, AilaCodeTypeUPC, etc.

data

The data contained inside the barcode.

Type: NSString / String

For a UPC-A code "123456789999", this property would contain the string "123456789999".

Methods

typeDescription

Returns the descriptive text for the barcode symbology.

Returns: NSString / String

For example, for AilaCodeTypeQR, this returns "QR".

Usage Example

config.scanCallback = ^(NSArray<AilaScanObject *> *results) {
for (AilaScanObject *scan in results) {
// Get type enum
AilaCodeType type = scan.type;

// Get human-readable type
NSString *typeStr = [scan typeDescription];

// Get barcode data
NSString *data = scan.data;

NSLog(@"Scanned %@ barcode: %@", typeStr, data);

// Check for specific type
if (type == AilaCodeTypeQR) {
NSLog(@"This is a QR code");
}
}
};

Subclasses

See Also