Dev Center
Swift
Objective-C
Table of contents

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. + (void)initLicense:(nonnull NSString *)license verificationDelegate:(nonnull id<DBRLicenseVerificationListener>)listener 
    NS_SWIFT_NAME(initLicense(_:verificationDelegate:));
    
  2. 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. [DynamsoftBarcodeReader initLicense:@"Put your license here" verificationDelegate: self];
    - (void)DBRLicenseVerificationCallback:(bool)isSuccess error:(NSError *)error{
    }
    
  2. 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. + (BOOL)setDeviceFriendlyName:(NSString *_Nullable)name error:(NSError *_Nullable *_Nullable)error;
    
  2. 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. [DynamsoftBarcodeReader setDeviceFriendlyName:@"Put your device name here" error:&error];
    
  2. do{
       try DynamsoftBarcodeReader.setDeviceFriendlyName("Put your device name here")
    }catch{
       // Add your code to deal with exceptions
    }
    

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article: