Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel2
maxLevel3

...

New and Improved!

Our Engineers have meticulously rewritten our Anyline iOS SDK from the ground up with Version 43. Here you will experience a wide array of game changing features, performance enhancements and overall ease-of-use improvements.

This article covers a summary of what v43 offers compared to our previous versions, a video guide on how to upgrade from any previous version of our Anyline iOS SDK to v43, links to the documentation, and a glossary of some of the terminology associated with our SDK.

...

Before and After

Previous versions of Anyline SDK

...

Version 43 of Anyline SDK

...

...

Changes in Version 43

Anyline iOS SDK previous versions

Expand
titleInitializing the plugin
  • Implementing a scan module requires the following classes to be initialized:

  1. a scan view

  2. a scan view plugin

  3. a scan plugin

  • the second and third class specify the scanning module you have selected.
    For instance:
    OCR → ALOCRScanViewPlugin ALOCRScanPlugin

Example:

Code Block
languageobjective-c
NSError *error = nil;
self.licensePlateScanPlugin = [[ALLicensePlateScanPlugin alloc] initWithPluginID:@"LICENSE_PLATE" delegate:self error:&error];
NSAssert(self.licensePlateScanPlugin, @"Setup Error: %@", error.debugDescription);
[self.licensePlateScanPlugin addInfoDelegate:self];

self.licensePlateScanViewPlugin = [[ALLicensePlateScanViewPlugin alloc] initWithScanPlugin:self.licensePlateScanPlugin];

NSString *confPath = [[NSBundle mainBundle] pathForResource:@"license_plate_capture_config" ofType:@"json"];
ALScanViewPluginConfig *scanViewPluginConfig = [ALScanViewPluginConfig configurationFromJsonFilePath:confPath];

self.licensePlateScanViewPlugin = [[ALLicensePlateScanViewPlugin alloc] initWithScanPlugin:self.licensePlateScanPlugin
                                                scanViewPluginConfig:scanViewPluginConfig];

self.scanView = [[ALScanView alloc] initWithFrame:CGRectZero scanViewPlugin:self.licensePlateScanViewPlugin];

if (error) {
  // handle the error
    NSLog(@"The error: %@", error.localizedDescription);
}
Expand
titleComposite plugins
  • cancelOnResult is a required field and is either true or false. id should be a valid keyword string and is a required field. viewPlugins is an array where the viewPlugin JSON bodies of each child plugin is listed.

Example:

Code Block
languagejson
{
  "serialViewPluginComposite": {
      "id": "CATTLE_DL_VIN",
      "cancelOnResult": true,
      "viewPlugins": [
          {
              "viewPlugin": {
                  "plugin": {
                      "id": "CATTLE_TAG",
                      "ocrPlugin": {
                          "cattleTagConfig": {}
                      }
                  },
                  ...
              }
          },
          {
              "viewPlugin": {
                  "plugin": {
                      "id": "DRIVING_LICENSE",
                      "idPlugin": {
                              ...
                      }
                  },
                  ...
          }
      ]
  }
}
Expand
titleJSON Config File Structure
  • Previous config files are parsed with the top-level keys identified as the objects they represent.

  • For example: The JSON configuration for the camera on a device is under the key identifier, camera ; the JSON configuration for the flash of the camera is under the key identifier, flash, and so on.

  • The cancelOnResult method is found inside the viewPlugin

Example:

Code Block
languagejson
{
  "viewPlugin": {
      "plugin": {
          "id": "LICENSEPLATE_PLUGIN",
          "licensePlatePlugin": {
              "scanMode": "AUTO"
        }
      },
      "cutoutConfig" : {
          "style": "rect",
          "maxWidthPercent": "70%",
          "maxHeightPercent": "70%",
          "alignment": "top_half",
          "ratioFromSize": {
              "width": 3,
              "height": 1
          },
          "outerColor": "000000",
          "outerAlpha": 0.3,
          "strokeWidth": 1,
          "strokeColor": "FFFFFF",
          "cornerRadius": 2,
          "feedbackStrokeColor": "0099FF"
      },
      "scanFeedback": {
          "animation": "none",
          "animationDuration" : 250,
          "style": "rect",
          "strokeWidth": 2,
          "strokeColor": "0099FF",
          "beepOnResult": true,
          "vibrateOnResult": true,
          "blinkAnimationOnResult": true
      },
      "cancelOnResult" : true
  }
}
Expand
titleDelegate Methods
  • The ALScanPlugin, ALScanViewPlugin, and ALScanView delegates all require the implementation different delegate protocols for specific modules

  • Some module specific delegate examples are ALOCRScanPluginDelegate, ALIDScanPluginDelegate, ALLicensePlateScanPluginDelegate, and so on.

Example:

Code Block
languageobjective-c
@interface ALLicensePlateViewController ()<ALLicensePlateScanPluginDelegate, ALInfoDelegate, ALScanViewPluginDelegate>

@property (nonatomic, strong) ALLicensePlateScanViewPlugin *licensePlateScanViewPlugin;
@property (nonatomic, strong) ALLicensePlateScanPlugin *licensePlateScanPlugin;
@property (nullable, nonatomic, strong) ALScanView *scanView;

@end
Expand
titleResult Type
  • ALScanResult does not support strongly-typed result types of modules and are not defined as part of the result object.

Example:

Code Block
languageobjective-c
// This is the main delegate method Anyline uses to report its results
- (void)anylineLicensePlateScanPlugin:(ALLicensePlateScanPlugin *)anylineLicensePlateScanPlugin
                        didFindResult:(ALLicensePlateResult *)result {

    //Handle the returned scan Result here.
    NSLog(@"The scan result: %@", result.result);
}

Anyline iOS SDK v43

Expand
titleInitializing the plugin
  • Only the ALScanView and ALScanViewPlugin need to be initialized, with an appropriate ALScanPlugin being generated by the ALScanViewPlugin when the configuration for the target module is passed.

Example:

Code Block
languageobjective-c
// Create the ScanViewPlugin together with the scanPlugin
self.scanViewPlugin = [[ALScanViewPlugin alloc] initWithJSONDictionary:JSONConfigDictionary error:&error];
if (error) {
  // handle the error.
    NSLog(@"The error: %@", error.localizedDescription);
}

self.scanPlugin = self.scanViewPlugin.scanPlugin;

self.scanPlugin.delegate = self;

  • Furthermore, the scan view config is now initialized together with its scan view plugin.

Example:

Code Block
languageobjective-c
// Create a ScanView using a ScanView config, based on the JSON String or JSON file you use
ALScanViewConfig *scanViewConfig = [[ALScanViewConfig alloc] initWithJSONDictionary:JSONConfigDictionary error:&error];
if (error) {
  // handle the error
    NSLog(@"The error: %@", error.localizedDescription);
}

self.scanView = [[ALScanView alloc] initWithFrame:CGRectZero // Should have a "non zero" frame
                                    scanViewPlugin:self.scanViewPlugin // Make sure to check info.plist and add privacy - CUD
                                    scanViewConfig:scanViewConfig
                                            error:&error];
if (error) {
  // handle the error
    NSLog(@"The error: %@", error.localizedDescription);
}
Expand
titleComposite plugins
  • The root node’s JSON property is named viewPluginCompositeConfig.

  • An additional property named PROCESSING_MODE needs to be set to either sequential or parallel. id should be a valid keyword string and is a required field. viewPlugins is an array where the viewPluginConfig JSON bodies of each child plugin is listed.

  • The PluginComposite class, which replaces the old composite plugin* type, is now (along with ScanViewPlugin) a concrete implementation of the ScanViewPluginBase protocol*.

  • Along with this, we’ve also added a helper class, ALScanViewPluginFactory, to initialize both types from a JSON configuration object.

Example:

Code Block
languagejson
{
    "viewPluginCompositeConfig": {
        "id": "parallel_composite_scanning",
        "processingMode": <PROCESSING_MODE>,
        "viewPlugins": [
            {
                "viewPluginConfig": {
                    "pluginConfig": {
                        "id": "com.anyline.configs.plugin.lp",
                        "licensePlateConfig": {
                        "scanMode": "auto"
                        }
                    },
                    ...
                },
                "viewPluginConfig": {
                    ...
                },
                ...
            }
        ]
    }
}
Expand
titleJSON Config File Structure
  • New config files are parsed with the top-level keys identified both as the objects they represent and with the key name “config”.

  • For example: The JSON configuration for the camera on a device is under the key identifier, cameraConfig ; the JSON configuration for the flash of the camera is under the key identifier, flashConfig, and so on.

  • The cancelOnResult method is found inside the pluginConfig.

Example:

Code Block
languagejson
{
  "cameraConfig": {
    "captureResolution": "1080p",
    "pictureResolution": "1080p"
  },
  "flashConfig": {
    "mode": "auto",
    "alignment": "top_left"
  },
  "viewPluginConfig": {
    "pluginConfig": {
      "id": "LPT",
      "licensePlateConfig": {
        "scanMode": "auto"
      },
      "cancelOnResult": true
    },
    "cutoutConfig": {
      "animation": "fade",
      "maxWidthPercent": "100%",
      "maxHeightPercent": "100%",
      "width": 750,
      "alignment": "top_half",
      "ratioFromSize": {
        "width": 3,
        "height": 1
      },
      "offset": {
        "x": 0,
        "y": 0
      },
      "cropOffset": {
        "x": 0,
        "y": 0
      },
      "cropPadding": {
        "x": 0,
        "y": 0
      },
      "cornerRadius": 4,
      "strokeColor": "0099ff",
      "strokeWidth": 2,
      "outerColor": "000000",
      "feedbackStrokeColor": "0099FF",
      "outerAlpha": 0.3
    },
    "scanFeedbackConfig": {
      "style": "rect",
      "visualFeedbackRedrawTimeout": 100,
      "strokeWidth": 2,
      "strokeColor": "0099FF",
      "fillColor": "220099FF",
      "beepOnResult": true,
      "vibrateOnResult": true,
      "blinkAnimationOnResult": true
    }
  }
}
Expand
titleDelegate Methods
  • The ALScanPlugin, ALScanViewPlugin, and ALScanView delegates* have been altered, with the removal of implementing different module delegate protocols. This has resulted in a more focused and efficient interface with more time-saving features.

  • Module specific delegates such as ALOCRScanPluginDelegate, ALIDScanPluginDelegate, etc., are now removed and replaced by a single protocol: ALScanPluginDelegate.

Example:

Code Block
languageobjective-c
@interface ViewController ()<ALScanPluginDelegate>

@property (nonatomic, strong) ALScanViewPlugin *scanViewPlugin;
@property (nonatomic, strong) ALScanPlugin *scanPlugin;
@property (nonatomic, strong) ALScanView *scanView;

@end
Expand
titleResult Type
  • ALScanResult now supports strongly-typed result types of modules and are defined as part of the result object.

  • This means that for any module you are scanning (for instance, OCR), then the module result (in this case, ocrResult) will be a non-null property where you will be able to find the result.

Example:

Code Block
languageobjective-c
// HAVE A DELEGATE METHOD WAITING IN YOUR VIEW CONTROLLER TO ACCEPT THE CALLBACK
- (void)scanPlugin:(ALScanPlugin *)scanPlugin resultReceived:(ALScanResult *)scanResult {
    NSLog(@"Result of scan result found: %@", scanResult.pluginResult.licensePlateResult.plateText);
}

...

Upgrading to v43

Info

To watch the video tutorial, please click here.

Tip

...

Other Additions

Tip
  • Added ALPluginConfig for describing configuration data.

    • Added a type of configuration for each scanning capability.

  • Added ALPluginResult for describing result data.

    • Added a type of plugin result for each scanning capability.

  • [Tire] Added tire size specification fields to the result.

  • [Barcode] Added AAMVA parsing for PDF417 codes on driving licenses.

  • [ID] Restructured ID results in a way that every field can contain date- & multi-language information.

...

Links to Documentation

Panel
panelIconId803ee26c-b61d-4bd6-89ca-ecfd9325facf
panelIcon:anyline:
panelIconText:anyline:
bgColor#E6FCFF

If you require any further information or details on our v43 upgrade for the Anyline iOS SDK,
please click here to see our documentation page: anyline.com/ios-sdk-version43.0.0 Documentation Page.

...

Glossary

Please NotePLEASE NOTE:

*Protocol - Contains a blueprint of methods and properties which perform a specific task or functionality, and is implemented by the class that adheres to said protocol.

*Delegate - Refers to the class that adheres to a protocol and implements methods contained within the protocol.

*Composite Plugin - Running a composite plugin either sequentially or simultaneously puts more than one discrete plugin to work. There are two modes which one can use:

  • sequential mode: when the workflow requires you to scan a license plate, and then a VIN. This mode runs two separate scan plugins one after another, but within a composite you get the combined result of the two when you finish scanning both.

  • parallel mode: you are running two or more plugins simultaneously. (For example an ID card with a PDF417 barcode in it). Both are scanned, and the results are presented when you are done.

...