This guide provides an overview of how to build and run the sample app using our IOS SDK.

Prerequisites

These are the frameworks you must have before starting to use OCRLabs SDKs:

  • Xcode Project or an equivalent IDE for IOS development.
  • Visual Studio or an equivalent IDE for IOS development.
  • Minimum IOS SDK version: 8.
  • The latest SDK files (version 3.6.1503.2022) and Code Sample App from your Account Manager.

Step 1: Create a New Project

Create a new project in the following procedure:

  • Click New > Select IOS app and Single View app.
  • Click Next > Type in the Project Name > Next > Click Create.

Create new projectCreate new project

Step 2: Give Permission

Permission is granted in the following procedure:

  • On the Visual Studio open your Project Folder > info.plist.
  • Add new entry > privacy camera usage description.
  • Type in on the entry's value section We capture your ID using a camera.

Give permissionGive permission

Step 3: Create the Buttons

The Buttons are created in the following procedure:

  • Open your Project folder > Main.storyboard.
  • Double click the Main.storyboard to open it on the Xcode.
  • Click the main file on the Xcode and create the three buttons.
13651365

Create the Buttons

Step 4: Create the Buttons' Functions

The Button's functions can be created in the following procedure:

  • Click the ViewController on the Xcode.
  • Insert the following code under the @interface ViewController function.
-(IBAction) OnIDCard_Click : (id)sender {
}
-(IBAction) OnMedicare_Click : (id)sender {
}
-(IBAction) OnPassport_Click : (id)sender {
}

create button functioncreate button function

Step 5: Link the Buttons with the Functions

Link the Buttons with the Functions in the following procedure:

  • Click the main file on the Xcode.
  • Drag each button to the respective function on the ViewController.

Give permissionGive permission

Step 6: Copy the Frameworks Into Your Project Folder

Connect the frameworks to your project in the following procedure:

  • Copy the downloaded dll files into your project folder.
  • Create a new folder named References and paster the frameworks there.
  • On the Visual Studio right-click the references > add references > .net assembly > browse > select the frameworks > click Ok.

Link the FrameworkLink the Framework

Step 7: Import the Framework

Import the Frameworks using the following procedure:

  • Insert the following code on the ViewController.
using Xamarin.iOS.OrbitMedicare;
using Xamarin.iOS.OrbitMrz;
using Xamarin.iOS.OrbitScanID;

Import the FrameworkImport the Framework

Step 8: Insert the Start Scanning Function

The start scanning function can be inserted in the following procedure:

  • Open your Project Folder > ViewController.
  • Insert the following code under the ViewController.
partial void OnIDCard_Click(Foundation.NSObject sender) {
}
partial void OnMedicare_Click(Foundation.NSObject sender){
}
partial void OnPassport_Click(Foundation.NSObject sender){
}

Scan codeScan code

  • After that, insert the following start scanning code into the code for the ID Card.
ScanIDResultDelegate scanIDResultDelegate = new ScanIDResultDelegate(this);

    Orbit4ScanIDViewController anzVC = new Orbit4ScanIDViewController(scanIDResultDelegate);

    // Set Document Type
    anzVC.RequestParam = "AUS_AUTO_DRIVERLICENCE";

    // To be enable back card scan here
    anzVC.ScanBackSide = true;

    PresentViewController(anzVC, true, null);
  • Insert the following start scanning code into the code for the Medicare Card.
MedicareResultDelegate medicareResultDelegate = new MedicareResultDelegate(this);
    Orbit4MedicareViewController medVC = new Orbit4MedicareViewController(medicareResultDelegate);

    medVC.RequestParam = "AUS_MEDICARE";

    PresentViewController(medVC, true, null);
  • Insert the following start scanning code into the code for the Passport Card.
MrzResultDelegate mrzResultDelegate = new MrzResultDelegate(this); 

    OrbitMrzViewController mrzVC = new OrbitMrzViewController(mrzResultDelegate);

    // Set Scan Mode
    mrzVC.ScanMode = OrbitMrzScanMode.Camera;
    mrzVC.RequireImage = true;

    PresentViewController(mrzVC, true, null);

Scan codeScan code

Step 9: Handle the Result

Handle the Result in the following procedure:

  • Open your Project Folder > ViewController.
  • Insert the following result delegate for the Id card code on the ViewController.
public class ScanIDResultDelegate : Orbit4ScanIDResultDelegate
        {
            ViewController rootVC;

            public ScanIDResultDelegate(ViewController rootVC)
            {
                this.rootVC = rootVC;
            }

            public override void Result(Orbit4ScanIDViewController sdkViewController, ScanIDOCRResult result, UIImage imgDocF, UIImage imgDocB, UIImage imgDocFace, UIImage imgCamFace)
            {
                rootVC.DismissViewController(true, () => {
                    var resultStr = "";
                    if (result.StatusCode != "200")
                    {
                        resultStr = "Failed! Status code " + result.StatusCode;
                    }
                    else
                    {
                        resultStr += result.ResultString;
                    }

                    rootVC.lblResult.Text = resultStr;
                    Console.WriteLine(resultStr);
                });
            }
        }
  • Insert the following result delegate for the Medicare card code on the ViewController.
public class MedicareResultDelegate : Orbit4MedicareResultDelegate
        {
            ViewController rootVC;

            public MedicareResultDelegate(ViewController rootVC)
            {
                this.rootVC = rootVC;
            }

            public override void Result(Orbit4MedicareViewController sdkViewController, MedicareOCRResult result, UIImage frontImage, UIImage backImage, UIImage faceImage)
            {
                rootVC.DismissViewController(true, () => {
                    var resultStr = "";
                    if (result.StatusCode != "200")
                    {
                        resultStr = "Failed! Status code " + result.StatusCode;
                    }
                    else
                    {
                        resultStr += result.ResultString;
                    }

                    rootVC.lblResult.Text = resultStr;
                });
            }
        }
  • Insert the following result delegate for the Passport card code on the ViewController.
public class MrzResultDelegate : OrbitMrzViewControllerDelegate
        {
            ViewController rootVC;

            public MrzResultDelegate(ViewController rootVC)
            {
                this.rootVC = rootVC;
            }

            public override void WithImage(MRZOCRResult response, UIImage image, UIImage imgFace, OrbitMrzViewController orbitCreditViewController)
            {
                rootVC.DismissViewController(true, () => {
                    var resultStr = "";
                    if (response.StatusCode != "200")
                    {
                        resultStr = "Failed! Status code " + response.StatusCode;
                    }
                    else
                    {
                        resultStr += response.ResultString;
                    }

                    rootVC.lblResult.Text = resultStr;
                });
            }
        }

handle resulthandle result

Step 10: Create the Label for the Result

Create the Label for the Result in the following procedure:

  • Click on your Project Folder > Main.storyboard.
  • On the Xcode Project ViewController, input the following code.
@property IBOutlet UILabel * lblResult;

Import the FrameworkImport the Framework

  • Click Main, then drag the label to link it up with the functions that have just been created.

Import the FrameworkImport the Framework

  • Go back to Visual studio > ViewController, create the label definition, insert the following code under the UIViewControll class:
public UILabel lblResult;

Import the FrameworkImport the Framework

💬 We're here to help!

If you encounter an issue, a bug, or require assistance, please contact our support page here to find the solution. Don't forget to provide any important information on the issue.