Skip to content

Latest commit

 

History

History
116 lines (93 loc) · 3.05 KB

File metadata and controls

116 lines (93 loc) · 3.05 KB
layout title description keywords needAutoGenerateSidebar noTitleIndex multiProgrammingLanguage enableLanguageSelection ignore permalink
default-layout
License Methods - Dynamsoft Barcode Reader iOS API Reference
This page shows License methods of Dynamsoft Barcode Reader for iOS SDK.
initWithLicense, initWithLicenseFromServer, outputLicenseToString, license methods, api reference, objective-c, oc, swift
true
true
true
true
true
/programming/objectivec-swift/api-reference/primary-license.html

License Methods

Method Description
initLicense Initialize license for DynamsoftBarcodeReader.
setDeviceFriendlyName Sets a human-readable name that identifies the device.

initLicense

Initializes DynamsoftBarcodeReader with a license.

>- Objective-C >- Swift > >1. ```objc + (void)initLicense:(nonnull NSString *)license verificationDelegate:(nonnull id)listener NS_SWIFT_NAME(initLicense(_:verificationDelegate:)); ``` 2. ```swift class func initLicense(_ license: String, verificationDelegate listener: DBRLicenseVerificationListener) ```

Parameters

[in] license The license key. [in, out] verificationDelegate The listener that handles callback when the license verification message is returned by the license server. See also DBRLicenseVerificationListener.

Return Value

The instance of DynamsoftBarcodeReader.

Code Snippet

>- Objective-C >- Swift > >1. ```objc [DynamsoftBarcodeReader initLicense:@"Put your license here" verificationDelegate: self]; - (void)DBRLicenseVerificationCallback:(bool)isSuccess error:(NSError *)error{ } ``` 2. ```swift DynamsoftBarcodeReader.initLicense("Put your license here", verificationDelegate: self) func dbrLicenseVerificationCallback(_ isSuccess: Bool, error: Error?) { } ```

setDeviceFriendlyName

Sets a human-readable name that identifies the device. This name will appear in the device details table when you check the statistics of the according license.

>- Objective-C >- Swift > >1. ```objc + (BOOL)setDeviceFriendlyName:(NSString *_Nullable)name error:(NSError *_Nullable *_Nullable)error; ``` 2. ```swift class func setDeviceFriendlyName(_ name: String?) throws ```

Parameters

[in] name The user-defined device name.
[in,out] error: A pointer to an error object.

An error occurs when:

  • Failed to set device friendly name.

Return Value

A BOOL value that indicates whether the device name setting is approved.

Code Snippet

>- Objective-C >- Swift > >1. ```objc [DynamsoftBarcodeReader setDeviceFriendlyName:@"Put your device name here" error:&error]; ``` 2. ```swift do{ try DynamsoftBarcodeReader.setDeviceFriendlyName("Put your device name here") }catch{ // Add your code to deal with exceptions } ```