BRScanManager
The main interface for initiating scanning sessions. Access via BRScanManager.shared().
Declaration
@interface BRScanManager : NSObject
class BRScanManager : NSObject
Quick Reference
Class Methods
| Method | Description |
|---|---|
+sharedManager | Returns the shared BRScanManager instance. |
Properties
| Property | Description |
|---|---|
licenseKey | Your BlinkReceipt license key. |
prodIntelKey | Your BlinkReceipt Product Intelligence key. |
clientUserId | A client-specified identifier for the current user. |
googlePlacesApiKey | Google Places Web Service API Key for store location enrichment. |
yelpApiKey | Yelp API Key for store information enrichment. |
userFramesFilepaths | Array of file paths to user-confirmed images from the previous scan session. |
daysToStoreReceiptData | Controls how many days receipt data is retained in local storage. |
deviceCanProcessVideo | Indicates whether the current device is capable of processing video frames for scanning. |
Methods
| Method | Description |
|---|---|
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. |
createMailControllerWithDebugInfo | Creates 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
| Parameter | Description |
|---|---|
viewController | The presenting view controller. |
cameraType | The camera UX style to use (e.g., .standard, .enhanced). |
scanOptions | A configured BRScanOptions instance. |
delegate | The 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.
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:
| Parameter | Description |
|---|---|
customController | Your BRCameraViewController subclass instance |
viewController | The presenting view controller |
scanOptions | A configured BRScanOptions instance, or nil for defaults |
delegate | The 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:
| Parameter | Description |
|---|---|
customController | Your BRCameraViewController subclass instance |
navCon | The navigation controller to push onto |
scanOptions | A configured BRScanOptions instance, or nil for defaults |
delegate | The 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.
PDF max size is 10 MB.
Parameters:
| Parameter | Description |
|---|---|
pdfData | The raw PDF data to scan |
countryCode | ISO country code for regional parsing |
completion | Called 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:
| Parameter | Description |
|---|---|
activationDate | The date the user activated the promotion |
promotionSlug | The 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:
| Parameter | Description |
|---|---|
blinkReceiptId | The BlinkReceipt ID of the receipt to correct |
vc | The view controller to present the correction flow from |
countryCode | ISO country code, or nil |
customFont | Custom font for the correction UI, or nil for the default |
completion | Called 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:
| Parameter | Description |
|---|---|
blinkReceiptId | The BlinkReceipt ID of the receipt to retrieve |
completion | Called 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:
| Parameter | Description |
|---|---|
scanResults | The corrected BRScanResults object |
countryCode | ISO country code, or nil |
completion | Called 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:
| Parameter | Description |
|---|---|
completion | Called 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:
| Parameter | Description |
|---|---|
completion | Called 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:
| Parameter | Description |
|---|---|
survey | The BRSurvey to display |
viewController | The view controller to present the survey from |
completion | Called 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:
| Parameter | Description |
|---|---|
survey | The completed BRSurvey object with user responses |