Skip to content

BlinkReceipt/blinkreceipt-ping-ios

Repository files navigation

BlinkReceipt Integration Instructions

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like BlinkReceipt in your projects. If you do not have Cocoapods installed, see the Getting Started Guide.

Podfile

#You must include this additional source as the BlinkReceipt pod is hosted in a private spec repository
source 'https://github.com/BlinkReceipt/PodSpecRepo.git'
source 'https://cdn.cocoapods.org/'

platform :ios, '12.0'

target 'YourTarget' do
  use_frameworks!
  
  pod 'BlinkReceiptPing', '~> 1.22' 
end

After editing your Podfile, run pod install and then make sure to open the .xcworkspace file rather than the .xcodeproj

Integration

  • Add the following to the top of your AppDelegate.m:
#import <BlinkReceiptPing/BlinkReceiptPing.h>
  • Add the following to the applicationDidFinishLaunching: method:
[BRScanManager sharedManager].licenseKey = @"YOUR-LICENSE-KEY";
  • The simplest way to test the SDK is by launching our prepackaged scanning experience

Prepackaged Scanning Experience

This scanning mode simulates the user snapping a series of still photos although in fact live video frames are actually being scanned in the background. To test this:

  • Add the following code to the top of your view controller
#import <BlinkReceiptPing/BlinkReceiptPing.h>
  • Add the following code to an IBAction handler in your view controller:
- (IBAction)btnTouched:(id)sender {
  BRScanOptions *scanOptions = [BRScanOptions new];
  
  [[BRScanManager sharedManager] startStaticCameraFromController:self
                                                     scanOptions:scanOptions
                                                    withDelegate:self];
}
  • Declare your view controller to conform to BRScanResultsDelegate:
@interface MyViewController () <BRScanResultsDelegate>
  • Implement the delegate callback to handle scan results:
- (void)didFinishScanning:(UIViewController *)cameraViewController withScanResults:(BRScanResults *)scanResults {
    [cameraViewController dismissViewControllerAnimated:YES completion:nil];
        
    //Use scan results
}

Custom Camera Controller UI

You can also build out your own UI that sits on top of our basic camera controller. To do so, all you have to do is subclass BRCameraViewController and create your UI programmatically or in Interface Builder as normal.

#import <BlinkReceiptPing/BlinkReceiptPing.h>

@interface MyCameraController : BRCameraViewController
  • Note that you must set the background of your view to be transparent so that the camera controller underneath will be visible.

Your camera controller interacts with properties and methods of its superclass to facilitate the scanning experience. For details refer to BRCameraViewController.h

To begin scanning with your custom controller use the following in your IBAction handler:

MyCameraController *cameraController = [MyCameraController new]; //or instantiate from storyboard

[[BRScanManager sharedManager] startCustomCamera:cameraController
                                  fromController:self
                                     scanOptions:scanOptions
                                    withDelegate:self];

Copyright (c) 2017 BlinkReceipt. All rights reserved.