User Corrected Results

User Corrected Results (UCR) lets your end-users tell Anyline when a scan was wrong: they simply type the value they should have received and send the corrected result to Anyline to improve future accuracy.

Prerequisites

UCR is opt-in, and you decide how it is implemented in your app. Additionally, your Anyline License Key needs to have the relevant flag enabled for UCR. Please contact your CSM or Support for further information.

Reporting a corrected result

After a successful scan, you can provide your end user with a UI element to correct the scanned data. To send this corrected data to Anyline, you have two options:

  1. via instance method, using the ALScanResult object

    • convenient for usage directly after scanning.

  2. via class method, using the blobKey

    • in case you store the blobKey for later reference.

Instance method - using ALScanResult

  • Swift

  • Objective-C

// assume `scanResult` is an ALScanResult you just received

do {
    let response = try scanResult.reportCorrectedResult("this is the correct value")
    print("Correction sent, response: \(response)")
} catch {
    print("Failed to report correction:", error)
}
// assume `scanResult` is an ALScanResult you just received
NSError *error = nil;
NSString *response = [scanResult reportCorrectedResult:@"this is the correct value"
                                                 error:&error];

if (response) {
    NSLog(@"Correction sent, response: %@", response);
} else {
    NSLog(@"Failed to report correction: %@", error);
}

Class method - using blobKey

  • Swift

  • Objective-C

// var blobKey = "Your blobKey"
// var correctedResult = "Your corrected result"

do {
    let response = try ALScanResult.reportCorrectedResult(fromBlobKey: blobKey,
                                                      correctedResult: correctedResult,
                                                               apiKey: nil // apiKey should be nil
    )
    print("Correction sent, response: \(response)")
} catch {
    print("Failed to report correction:", error)
}
// NSString *blobKey         = @"Your blobKey";
// NSString *correctedResult = @"Your corrected result";

NSError *error = nil;

NSString *response = [ALScanResult reportCorrectedResultFromBlobKey:blobKey
                                                    correctedResult:correctedResult
                                                             apiKey:nil      // apiKey should be nil
                                                              error:&error];

if (response) {
    NSLog(@"Correction sent, response: %@", response);
} else {
    NSLog(@"Failed to report correction: %@", error);
}

Wait about 1 second after the original scan call before reporting the correction so the backend has the original result first.