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.
source 'https://github.com/BlinkReceipt/PodSpecRepo.git'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'YourTarget' do
use_frameworks!
pod 'BlinkReceiptPing'
end
After editing your Podfile, run pod install
and then make sure to open the .xcworkspace
file rather than the .xcodeproj
- 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
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
}
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.