SCAN SDK iOS

The SCAN SDK is a powerful SDK that enables developers to integrate scanning functionalities into their iOS applications.

The SCAN SDK supports the scanning of various objects, such as

Supported Number Plates

SCAN SDK has been trained to recognize European car number plates.

Supported Barcode Formats

Linear productLinear industrialMatrix
UPC-ACode 39QR Code
UPC-ECode 93Micro QR Code
EAN-8Code 128rMQR Code
EAN-13CodabarAztec
DataBarDataBar ExpandedData Matrix
DX Film EdgePDF417
ITFMaxiCode (partial)
Visible Digital Seals

Preconditions

  • Xcode 13 or later
  • Swift 5.0 or later
  • Deployment Target 13.0 or later

Example App

The folder Example contains a minimal functional demo app, that shows the usage of the SDK. Remember to set your Team in the Signing & capabilities settings for the Target  Example in this project, when building for an iOS device.

Framework Installation

Swift Package Manager

To add SCAN SDK to your Xcode project using Swift Package Manager:

  1. Open your project in Xcode.
  2. Navigate to File > Add Package Dependencies.
  3. Enter the repository URL: https://github.com/OVD-Kinegram-AG/scan-sdk-ios and add the package.

Usage

Importing

Import the SCAN SDK in the file where you want to use it:

import KinegramScanSDK

Quick Start

Here is a simple example of how to use the scanner in your application:

import UIKit
import KinegramScanSDK

class ViewController: UIViewController {

	let scanSdk = KSCScanSDK()

	@IBAction func buttonStartScannerTouched(_ sender: UIButton) {
		scanSdk.startScanner(withDelegate: self, title: "ScanSDK Demo")
	}
}

extension ViewController: KSCResultDelegate {
	func found(_ results: [KSCResult]) {
		// Process results
		for result in results {
			print("Scanned result: \(result)")
		}
	}
}

Possible Return Values

KSCResult

An array of KSCResult objects is returned by the delegate method. Each KSCResult object contains the recognized data from the scan, along with its type,which is defined by the KSCResultType enum.

Handling Results

When using the KSCScanSDK,the results of the scan are returned through the KSCResultDelegate. Here is an example of how to handle different types of scan results:

...
extension ExampleViewController: KSCResultDelegate {
    func found(_ results: [KSCResult]) {
        for result in results {
            switch result.type {
            case .MRZ:
                if let mrz = result.mrz {
                    print("MRZ found: \(result.text)")
                    print(" documentCode: \(mrz.documentCode)")
                    print(" issuingState: \(mrz.issuingState)")
                    print(" primaryIdentifier: \(mrz.primaryIdentifier)")
                    print(" secondaryIdentifier: \(mrz.secondaryIdentifier)")
                    print(" nationality: \(mrz.nationality)")
                    print(" documentNumber: \(mrz.documentNumber)")
                    print(" dateOfBirth: \(mrz.dateOfBirth)")
                    print(" sex: \(mrz.sex)")
                    print(" dateOfExpiry: \(mrz.dateOfExpiry)")
                    print(" optionalData1: \(mrz.optionalData1)")
                    print(" optionalData2: \(mrz.optionalData2)")
                }

            case .NumberPlate:
                if let numberPlate = result.numberPlate {
                    print("NumberPlate found: \(numberPlate.text) Country: \(numberPlate.country)")
                }

            case .IDL:
                if let idl = result.idl {
                    print("IIN found: \(idl.iin)")
                    for key in idl.order {
                        if let key = key as? String, let value = idl.elements[key] {
                            print("\(key): \(value)")
                        }
                    }
                }

            case .Barcode:
                print("Barcode format: \(result.format)")
                print("Barcode text: \(result.text)")

            case .VDS:
                if let vds = result.vds {
                    print("VDS found:")
                    print("Country ID: \(vds.header.countryId)")
                    // ... see class KSCVDSInfo for more information
                    print("Signature Valid: \(vds.signatureValid)")
                }

            case .VDSNC:
                if let vdsnc = result.vdsnc {
                    print("VDS-NC found:")
                    print("Country ID: \(vdsnc.header.issuingCountry)")
                    // ... see class KSCVDSNCInfo for more information
                    print("Signature Valid: \(vdsnc.signatureValid)")
                    print("Certificate Known: \(vdsNc.certificateKnown)")
                }

            default:
                print(result.text)
            }
        }
    }
}

Additional Hints

1. NSCameraUsageDescription in Host App

As the SCAN SDK needs camera access, the host app has to put a usage description inside its lnfo.plist, otherwise the app crashes. Please add a string like this to the lnfo.plist of the host app:

⟨key⟩NSCameraUsageDescription⟨/key⟩
⟨string⟩$(PRODUCT_NAME)⟩ needs camera access to scan your documents.⟨/string⟩

Custom VDS Profiles

Use Scanner.setVDSProfiles() to specify custom VDS profiles before scanning:

Scanner.setVDSProfiles(
	"["
		"{\"id\":4128,\"features\":["
			"{\"tag\":2,\"name\":\"foo\",\"type\":\"UTF8STR\"}"
		"]}"
	"]"
)

The integer key (4128 in this example, which is 0x1020 hexadecimal, JSON does not support hexadecimal numbers, unfortunately) must be the “Document Feature Definition Reference” byte (0x10 in bit 9 to 16) and the “Document Type Category” byte (0x20 in bit 1 to 8). These bytes identify a VDS profile.

For each document feature you need to specify a tag (2), a name (foo) and a type (UTF8STR). Possible types are:

  • RAW – binary data
  • UBYTE – unsigned char
  • UINT16LE – unsigned 16-bit integer little endian
  • UINT24LE – unsigned 24-bit integer little endian
  • UINT32LE – unsigned 32-bit integer little endian
  • DATE – unsigned 24-bit integer big endian read as “MMddyyyy”
  • TIMESTAMP – Unix time stamp
  • UTF8STR – UTF8 string
  • C40STR – C40-encoded string
  • C40MRZMRVA – C40-encoded MRVA MRZ
  • C40MRZMRVB – C40-encoded MRVB MRZ
  • C40MRZTD2 – C40-encoded TD2 MRZ
  • C40MRZTD3 – C40-encoded TD3 MRZ

Verify a VDS

To verify a VDS, you need the certificate with which the VDS was signed.
Use Scanner.setCertificates() to specify a list of certificate files before scanning:
Scanner.setCertificates(listOf("path/to/certificate.cer"))

Verify a VDS-NC

To verify a VDS-NC the CSCA (Country Signing Certificate Authority) certificate of the issuing country is required. This certificate can be obtained from the ICAO Master List or the BSI Master List.
Use Scanner.setCMS() to specify a list of master list files before scanning:
Scanner.setCMS(listOf("path/to/masterlist.ml"))

License

Kinegram Scan SDK

Copyright 2024 OVD Kinegram AG

https://www.kinegram.com/

This product includes software developed by:

OpenCV

https://github.com/opencv/opencv

Apache License Version 2.0

TensorFlow

https://github.com/tensorflow/tensorflow

Apache License Version 2.0

ZXingCpp

https://github.com/zxing-cpp/zxing-cpp

Apache License Version 2.0

Support

If you encounter any issues or have any questions,we encourage you to open an issue in the GitHub issue tracker. Our team will be happy to assist you and address any problems you may have. Alternatively, you can contact us at digitalsolutions@kinegram.com.

Privacy Notice

Get more information about the
SCAN SDK iOS

Contact

    First Name *

    Last Name *

    Company *

    Position

    E-Mail *

    Phone *

    Message *

    *

    I agree that my data from the contact form will be collected to answer my request and for marketing and sales purposes. You can find more information in our privacy policy.