Skip to main content

BRScanManager

The main interface for initiating scanning sessions. Access via BRScanManager.shared().

Declaration

@interface BRScanManager : NSObject
class BRScanManager : NSObject

Quick Reference

Class Methods

MethodDescription
+sharedManagerReturns the shared BRScanManager instance.

Properties

PropertyDescription
licenseKeyYour BlinkReceipt license key.
prodIntelKeyYour BlinkReceipt Product Intelligence key.
clientUserIdA client-specified identifier for the current user.
googlePlacesApiKeyGoogle Places Web Service API Key for store location enrichment.
yelpApiKeyYelp API Key for store information enrichment.
userFramesFilepathsArray of file paths to user-confirmed images from the previous scan session.
daysToStoreReceiptDataControls how many days receipt data is retained in local storage.
deviceCanProcessVideoIndicates whether the current device is capable of processing video frames for scanning.

Methods

MethodDescription
startStaticCamera:fromController:cameraType:scanOptions:withDelegate:Starts a scan session using the SDK's built-in camera controller.
startCustomCamera:fromController:scanOptions:withDelegate:Starts a scan session using your own BRCameraViewController subclass, presented modally.
pushCustomCamera:fromNavController:scanOptions:withDelegate:Starts a scan session using your own BRCameraViewController subclass, pushed onto a nav stack.
scanPDFReceipt:withCountryCode:withCompletion:Scans a PDF receipt. Max size: 10 MB.
createMailControllerWithDebugInfoCreates a mail compose controller pre-filled with debug info from the last scan.
setActivationDate:forPromotion:Records the date a user activated a specific promotion for purchase validation.
startReceiptCorrection:fromViewController:
withCountryCode:withCustomFont:withCompletion:
Begins the receipt correction flow for a receipt stored on disk.
getResultsForReceiptCorrection:withCompletion:Retrieves results from disk or remotely for a specific receipt for custom corrections flow.
submitUpdatedResultsForValidation:withCountryCode:withCompletion:After a custom correction flow, validates the updated results against promotions.
getPromotionsWithCompletion:Retrieves targeted and general promotions for the current user.
getSurveysWithCompletion:Retrieves surveys for the current user.
startSurvey:fromViewController:withCompletion:Displays a given survey using the prepackaged flow.
submitSurveyResults:Posts survey results after a custom survey UI flow.

Class Methods

+sharedManager

+ (BRScanManager *)sharedManager;
class func shared() -> BRScanManager

Always access this singleton instance. Use this to configure keys and start scan sessions.


Properties

licenseKey

@property (nonatomic, strong, nonnull) NSString *licenseKey;
var licenseKey: String { get set }

Your BlinkReceipt license key. Set this before starting any scan session.


prodIntelKey

@property (nonatomic, strong, nullable) NSString *prodIntelKey;
var prodIntelKey: String? { get set }

Your BlinkReceipt Product Intelligence key. Required for enriched product data (full product names, brands, categories, UPCs).

Default: nil


clientUserId

@property (nonatomic, strong, nullable) NSString *clientUserId;
var clientUserId: String? { get set }

A client-specified identifier for the current user. Used to correlate scan data with your own user records.

Default: nil


googlePlacesApiKey

@property (nonatomic, strong, nullable) NSString *googlePlacesApiKey;
var googlePlacesApiKey: String? { get set }

Google Places Web Service API Key for store location enrichment.

Default: nil


yelpApiKey

@property (nonatomic, strong, nullable) NSString *yelpApiKey;
var yelpApiKey: String? { get set }

Yelp API Key for store information enrichment.

Default: nil


userFramesFilepaths

@property (nonatomic, strong, nullable) NSArray<NSString *> *userFramesFilepaths;
var userFramesFilepaths: [String]? { get set }

Array of file paths to user-confirmed images from the previous scan session, available for upload or further processing.

Default: nil


daysToStoreReceiptData

@property (nonatomic) NSInteger daysToStoreReceiptData;
var daysToStoreReceiptData: Int { get set }

Controls how many days receipt data is retained in local storage for historical correction and editing. Set to 0 to disable local storage.

Default: 0


deviceCanProcessVideo (read-only)

@property (nonatomic, readonly) BOOL deviceCanProcessVideo;
var deviceCanProcessVideo: Bool { get }

Indicates whether the current device is capable of processing video frames for scanning.


Methods

startStaticCamera:fromController:cameraType:scanOptions:withDelegate:

- (void)startStaticCameraFromController:(UIViewController *)viewController
cameraType:(BRCameraUXType)cameraType
scanOptions:(BRScanOptions *)scanOptions
withDelegate:(id<BRScanResultsDelegate>)delegate;
func startStaticCamera(
from viewController: UIViewController,
cameraType: BRCameraUXType,
scanOptions: BRScanOptions,
with delegate: BRScanResultsDelegate
)

Presents the SDK's built-in camera controller and begins a scan session.

Parameters

ParameterDescription
viewControllerThe presenting view controller.
cameraTypeThe camera UX style to use (e.g., .standard, .enhanced).
scanOptionsA configured BRScanOptions instance.
delegateThe delegate to receive scan result callbacks.

createMailControllerWithDebugInfo

- (MFMailComposeViewController *)createMailControllerWithDebugInfo;
func createMailControllerWithDebugInfo() -> MFMailComposeViewController?

Creates a new MFMailComposeViewController populated with debug information about the most recent scan. The caller is responsible for setting the mailComposeDelegate and presenting/dismissing the view controller.

note

If this method is invoked on the simulator or a device with no email supported, it will output the message body to the console and return nil.


startCustomCamera:fromController:scanOptions:withDelegate:

- (void)startCustomCamera:(nonnull BRCameraViewController *)customController
fromController:(nonnull UIViewController *)viewController
scanOptions:(nullable BRScanOptions *)scanOptions
withDelegate:(nonnull NSObject<BRScanResultsDelegate> *)delegate;
func startCustomCamera(
_ customController: BRCameraViewController,
from viewController: UIViewController,
scanOptions: BRScanOptions?,
with delegate: any BRScanResultsDelegate
)

Initiates a scanning session using your own subclass of BRCameraViewController, presented as a modal from the supplied UIViewController.

Parameters:

ParameterDescription
customControllerYour BRCameraViewController subclass instance
viewControllerThe presenting view controller
scanOptionsA configured BRScanOptions instance, or nil for defaults
delegateThe delegate to receive scan result callbacks

pushCustomCamera:fromNavController:scanOptions:withDelegate:

- (void)pushCustomCamera:(nonnull BRCameraViewController *)customController
fromNavController:(nonnull UINavigationController *)navCon
scanOptions:(nullable BRScanOptions *)scanOptions
withDelegate:(nonnull NSObject<BRScanResultsDelegate> *)delegate;
func pushCustomCamera(
_ customController: BRCameraViewController,
fromNavController navCon: UINavigationController,
scanOptions: BRScanOptions?,
with delegate: any BRScanResultsDelegate
)

Initiates a scanning session using your own subclass of BRCameraViewController, pushed onto the supplied UINavigationController.

Parameters:

ParameterDescription
customControllerYour BRCameraViewController subclass instance
navConThe navigation controller to push onto
scanOptionsA configured BRScanOptions instance, or nil for defaults
delegateThe delegate to receive scan result callbacks

scanPDFReceipt:withCountryCode:withCompletion:

- (void)scanPDFReceipt:(nonnull NSData *)pdfData
withCountryCode:(nonnull NSString *)countryCode
withCompletion:(nonnull void (^)(BRScanResults *_Nullable, NSError *_Nullable))completion;
func scanPDFReceipt(_ pdfData: Data, withCountryCode countryCode: String) async throws -> BRScanResults

Scans a PDF receipt.

note

PDF max size is 10 MB.

Parameters:

ParameterDescription
pdfDataThe raw PDF data to scan
countryCodeISO country code for regional parsing
completionCalled with the parsed BRScanResults and any error

setActivationDate:forPromotion:

- (void)setActivationDate:(nonnull NSDate *)activationDate
forPromotion:(nonnull NSString *)promotionSlug;
func setActivationDate(_ activationDate: Date, forPromotion promotionSlug: String)

For purchase validation, records the date a user activated a specific promotion.

Parameters:

ParameterDescription
activationDateThe date the user activated the promotion
promotionSlugThe promotion slug identifier

startReceiptCorrection:fromViewController:withCountryCode:withCustomFont:withCompletion:

- (void)startReceiptCorrection:(nonnull NSString *)blinkReceiptId
fromViewController:(nonnull UIViewController *)vc
withCountryCode:(nullable NSString *)countryCode
withCustomFont:(nullable UIFont *)customFont
withCompletion:(nullable void (^)(BRScanResults *_Nullable, NSError *_Nullable))completion;
func startReceiptCorrection(
_ blinkReceiptId: String,
from vc: UIViewController,
withCountryCode countryCode: String?,
withCustomFont customFont: UIFont?
) async throws -> BRScanResults

Begins the receipt correction flow for a receipt stored on disk.

Parameters:

ParameterDescription
blinkReceiptIdThe BlinkReceipt ID of the receipt to correct
vcThe view controller to present the correction flow from
countryCodeISO country code, or nil
customFontCustom font for the correction UI, or nil for the default
completionCalled with the corrected BRScanResults and any error

getResultsForReceiptCorrection:withCompletion:

- (void)getResultsForReceiptCorrection:(nonnull NSString *)blinkReceiptId
withCompletion:(nonnull void (^)(BRScanResults *_Nullable, NSArray<UIImage *> *_Nonnull))completion;
func results(forReceiptCorrection blinkReceiptId: String) async -> (BRScanResults?, [UIImage])

Retrieves results from disk or remotely for a specific receipt, for use in a custom user corrections flow.

Parameters:

ParameterDescription
blinkReceiptIdThe BlinkReceipt ID of the receipt to retrieve
completionCalled with the BRScanResults and an array of receipt images

submitUpdatedResultsForValidation:withCountryCode:withCompletion:

- (void)submitUpdatedResultsForValidation:(BRScanResults *_Nonnull)scanResults
withCountryCode:(nullable NSString *)countryCode
withCompletion:(nullable void (^)(BRScanResults *_Nonnull, NSError *_Nullable))completion;
func submitUpdatedResults(
forValidation scanResults: BRScanResults,
withCountryCode countryCode: String?
) async throws -> BRScanResults

After a custom user correction flow, validates the updated results against promotions.

Parameters:

ParameterDescription
scanResultsThe corrected BRScanResults object
countryCodeISO country code, or nil
completionCalled with the validated results and any error

getPromotionsWithCompletion:

- (void)getPromotionsWithCompletion:(nonnull void (^)(NSArray<BRPromotionInfo *> *_Nullable))completion;
func promotions() async -> [BRPromotionInfo]?

Retrieves targeted and general promotions for the current user.

Parameters:

ParameterDescription
completionCalled with an array of BRPromotionInfo objects, or nil

getSurveysWithCompletion:

- (void)getSurveysWithCompletion:(nonnull void (^)(NSArray<BRSurvey *> *_Nullable))completion;
func surveys() async -> [BRSurvey]?

Retrieves surveys for the current user.

Parameters:

ParameterDescription
completionCalled with an array of BRSurvey objects, or nil

startSurvey:fromViewController:withCompletion:

- (void)startSurvey:(nonnull BRSurvey *)survey
fromViewController:(nonnull UIViewController *)viewController
withCompletion:(nullable void (^)(BOOL))completion;
func start(_ survey: BRSurvey, from viewController: UIViewController) async -> Bool

Displays a given survey using the prepackaged flow.

Parameters:

ParameterDescription
surveyThe BRSurvey to display
viewControllerThe view controller to present the survey from
completionCalled with YES if the survey was completed, NO if dismissed

submitSurveyResults:

- (void)submitSurveyResults:(nonnull BRSurvey *)survey;
func submitSurveyResults(_ survey: BRSurvey)

When displaying a survey using a custom UI, call this method after the user has completed the survey to post the results.

Parameters:

ParameterDescription
surveyThe completed BRSurvey object with user responses