Skip to main content

Notifications

All NSNotification constants provided by the Aila SDK.

Overview​

The SDK posts notifications to the default NSNotificationCenter for various events. Subscribe to these notifications to react to hardware changes, scan events, and other system events.

AilaMobileImagerStateChangedNotification​

Since 3.0.0

Posted when the scanning state is changed by depressing the dedicated scan buttons on Aila's Mobile Imager.

Aila_Start() and Aila_Stop() do not trigger this notification.

extern NSString *const AilaMobileImagerStateChangedNotification;

userInfo Dictionary:

KeyValue
state@YES if scanning started, @NO if stopped

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleImagerStateChanged:)
name:AilaMobileImagerStateChangedNotification
object:nil];

- (void)handleImagerStateChanged:(NSNotification *)notification {
BOOL isScanning = [notification.userInfo[@"state"] boolValue];
NSLog(@"Scanning state: %@", isScanning ? @"Started" : @"Stopped");
}

AilaHardwareChangedNotification​

Since 3.0.0

Posted when a change in system configuration is detected (e.g., hardware connected or disconnected).

extern NSString *const AilaHardwareChangedNotification;

userInfo Dictionary:

KeyValue
hardwareClass[NSNumber numberWithInt:Aila_GetHardwareClass()]

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleHardwareChanged:)
name:AilaHardwareChangedNotification
object:nil];

- (void)handleHardwareChanged:(NSNotification *)notification {
AilaHardwareClass hardwareClass = [notification.userInfo[@"hardwareClass"] intValue];
NSLog(@"Hardware changed: %d", hardwareClass);
}

AilaID1CardDetectedNotification​

Since 3.0.0

Posted when a card is detected in the tray (when id1CardDetectionMode is enabled).

extern NSString *const AilaID1CardDetectedNotification;

userInfo Dictionary: nil

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleCardDetected:)
name:AilaID1CardDetectedNotification
object:nil];

- (void)handleCardDetected:(NSNotification *)notification {
NSLog(@"Card detected in tray");
// Trigger image capture
Aila_ID1CaptureImage(^(UIImage *image, NSError *error) {
// Handle captured image
});
}

AilaMRZDetectedNotification​

Since 3.0.0

Posted when MRZ components are detected in the camera feed (when mrzDetectionMode is enabled).

This provides early indication that an MRZ document is present, before complete scanning occurs. The notification fires when the SDK detects any MRZ components such as document numbers, birth dates, expiry dates, or personal identification numbers.

extern NSString *const AilaMRZDetectedNotification;

userInfo Dictionary: nil

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMRZDetected:)
name:AilaMRZDetectedNotification
object:nil];

- (void)handleMRZDetected:(NSNotification *)notification {
NSLog(@"MRZ document detected");
// Update UI to guide user
}

AilaFirmwareNotification​

Since 3.0.0

Posted when an attempt at a firmware update is started or finished.

extern NSString *const AilaFirmwareNotification;

userInfo Dictionary:

Each notification carries one of these keys, set to @YES:

KeyValue
primaryFirmwareStart@YES when a primary firmware update starts
primaryFirmwareEnd@YES when a primary firmware update finishes successfully
secondaryFirmwareStart@YES when a secondary firmware update starts
secondaryFirmwareEnd@YES when a secondary firmware update finishes successfully

The end keys are posted only when an update succeeds. If an update fails, no end notification is posted.

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleFirmwareUpdate:)
name:AilaFirmwareNotification
object:nil];

- (void)handleFirmwareUpdate:(NSNotification *)notification {
NSDictionary *info = notification.userInfo;
if (info[@"primaryFirmwareStart"] || info[@"secondaryFirmwareStart"]) {
NSLog(@"Firmware update started");
} else if (info[@"primaryFirmwareEnd"] || info[@"secondaryFirmwareEnd"]) {
NSLog(@"Firmware update finished");
}
}

AilaSetCodesNotification​

Since 3.0.0

Posted when there is an internal setting or checking of enabled barcodes.

extern NSString *const AilaSetCodesNotification;

userInfo Dictionary: nil

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleSetCodes:)
name:AilaSetCodesNotification
object:nil];

- (void)handleSetCodes:(NSNotification *)notification {
NSLog(@"Barcode configuration changed");
}

AilaSetLicenseNotification​

Since 3.0.0

Posted when there are internal or cloud-based changes to the SDK licensing.

extern NSString *const AilaSetLicenseNotification;

userInfo Dictionary:

KeyValue
acceptedNSNumber wrapping a BOOL. @YES when the license was accepted and its features applied, @NO when it was rejected. Since 3.2.0
reasonNSString. Present when accepted is @NO. One of bundleIdMismatch, decryptOrParseFailed or invalidStructure. Since 3.2.0
errorNSString. Present when reason is decryptOrParseFailed. The underlying decryption or parsing error. Since 3.2.0
expectedBundleIdsNSArray of NSString. Present when reason is bundleIdMismatch. The bundle ID patterns the license was issued for. An entry may end in a * wildcard, such as com.ailatech.*. Since 3.2.0
appBundleIdNSString. Present when reason is bundleIdMismatch. The running app's bundle ID. Since 3.2.0

Usage:

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleLicenseChanged:)
name:AilaSetLicenseNotification
object:nil];

- (void)handleLicenseChanged:(NSNotification *)notification {
BOOL accepted = [notification.userInfo[@"accepted"] boolValue];
if (accepted) {
NSLog(@"License applied");
// Optionally refresh license info
NSString *info = Aila_GetSDKLicensingInfo();
} else {
NSLog(@"License rejected: %@", notification.userInfo[@"reason"]);
}
}

See Also​