Resource Base
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

Configure Settings

Method Description
initSettings Configures runtime settings using a provided JSON string, which contains settings for one or more CaptureVisionTemplates.
initSettingsFromFile Configures runtime settings using a provided JSON file, which contains settings for one or more CaptureVisionTemplates.
getSimplifiedSettings Retrieves a SimplifiedCaptureVisionSettings object that contains simplified settings for the specified CaptureVisionTemplate.
updateSettings Updates the specified CaptureVisionTemplate with a SimplifiedCaptureVisionSettings object.
resetSettings Reset the Capture Vision settings.
outputSettings Returns an object that contains settings for the specified CaptureVisionTemplate.
outputSettingsToFile Output the targeted Capture Vision settings to a JSON file.

initSettings

Configures runtime settings using a provided JSON string, which contains settings for one or more CaptureVisionTemplates.

  • Objective-C
  • Swift
  1. - (BOOL)initSettings:(NSString *)content
               error:(NSError * _Nullable * _Nullable)error
    
  2. func initSettings(_ content:String) throws -> BOOL
    

Parameters

content: A JSON string that contains Capture Vision settings.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_JSON_PARSE_FAILED -10030 Failed to parse the JSON data.
EC_JSON_TYPE_INVALID -10031 One or more parameters are allocated with wrong data type.
EC_JSON_KEY_INVALID -10032 There exists invalid key in your JSON data.
EC_JSON_VALUE_INVALID -10033 There exists invalid parameter value in your JSON data.
EC_JSON_NAME_KEY_MISSING -10034 One or more name parameters are missing in your JSON data. Each section of the JSON data requires a unique name parameter.
EC_JSON_NAME_VALUE_DUPLICATED -10035 There exists duplicated name parameters in your JSON data. The name parameter should be unique.
EC_JSON_NAME_REFERENCE_INVALID -10037 You have referenced an invalid name value in your JSON data.
EC_PARAMETER_VALUE_INVALID -10038 There exists invalid parameter value in your JSON data.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A BOOL value that indicates whether the settings are initialized successfully.

initSettingsFromFile

Configures runtime settings using a provided JSON file, which contains settings for one or more CaptureVisionTemplates.

  • Objective-C
  • Swift
  1. - (BOOL)initSettingsFromFile:(NSString *)file
                        error:(NSError * _Nullable * _Nullable)error
    
  2. func initSettingsFromFile(_ file:String) throws -> BOOL
    

Parameters

file: A JSON file that contains Capture Vision settings.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_FILE_NOT_FOUND -10005 The file is not found.
EC_JSON_PARSE_FAILED -10030 Failed to parse the JSON data.
EC_JSON_TYPE_INVALID -10031 One or more parameters are allocated with wrong data type.
EC_JSON_KEY_INVALID -10032 There exists invalid key in your JSON data.
EC_JSON_VALUE_INVALID -10033 There exists invalid parameter value in your JSON data.
EC_JSON_NAME_KEY_MISSING -10034 One or more name parameters are missing in your JSON data. Each section of the JSON data requires a unique name parameter.
EC_JSON_NAME_VALUE_DUPLICATED -10035 There exists duplicated name parameters in your JSON data. The name parameter should be unique.
EC_JSON_NAME_REFERENCE_INVALID -10037 You have referenced an invalid name value in your JSON data.
EC_PARAMETER_VALUE_INVALID -10038 There exists invalid parameter value in your JSON data.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A BOOL value that indicates whether the settings are initialized successfully.

getSimplifiedSettings

Retrieves a SimplifiedCaptureVisionSettings object that contains simplified settings for the specified CaptureVisionTemplate.

  • Objective-C
  • Swift
  1. - (nullable DSSimplifiedCaptureVisionSettings *)getSimplifiedSettings:(NSString *)templateName
                                                                error:(NSError * _Nullable * _Nullable)error;
    
  2. func getSimplifiedSettings(_ templateName:String) throws -> SimplifiedCaptureVisionSettings
    

Parameters

templateName: Name of the targeted Capture Vision template that is defined in a JSON string or a JSON file.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CONVERT_COMPLEX_TEMPLATE_ERROR -10061 The template you specified is a complex template which can not be output as a SimplifiedCaptureVisionSettings object.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A DSSimplifiedCaptureVisionSettings object.

Remarks

A single JSON string or file can define multiple Capture Vision templates. getSimplifiedSettings will only return the simplified settings of the template named in the input parameter, even though there could be several templates in the JSON string/file.

updateSettings

Updates the specified CaptureVisionTemplate with a SimplifiedCaptureVisionSettings object.

  • Objective-C
  • Swift
  1. - (BOOL)updateSettings:(NSString *)templateName
              settings:(nonnull DSSimplifiedCaptureVisionSettings *)settings
                 error:(NSError * _Nullable * _Nullable)error;
    
  2. func updateSettings(_ templateName:String, settings:SimplifiedCaptureVisionSettings) throws -> BOOL
    

Parameters

templateName: Specifies a CaptureVisionTemplate by its name.
settings: The SimplifiedCaptureVisionSettings object that contains updated settings.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_PARAMETER_VALUE_INVALID -10038 There exists invalid parameter value in your SimplifiedCaptureVisionSettings.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A bool value that indicates whether the settings are uploaded successfully.

resetSettings

Restores all runtime settings to their original default values.

  • Objective-C
  • Swift
  1. - (BOOL)resetSettings:(NSError * _Nullable * _Nullable)error;
    
  2. func resetSettings() throws -> BOOL
    

Parameters

error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A BOOL value that indicates whether the settings are reset successfully.

outputSettings

Returns an object that contains settings for the specified CaptureVisionTemplate.

  • Objective-C
  • Swift
  1. - (nullable NSString *)outputSettings:(NSString *)templateName
                                error:(NSError * _Nullable * _Nullable)error
    
  2. func outputSettings(_ templateName:String) throws -> String
    

Parameters

error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_TEMPLATE_NAME_INVALID -10036 The target template name is invalid.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

The Capture Vision settings in a JSON string.

outputSettingsToFile

Output a JSON file containing the settings for the specified CaptureVisionTemplate.

  • Objective-C
  • Swift
  1. - (BOOL)outputSettingsToFile:(NSString *)templateName
                        file:(NSString *)file
                       error:(NSError * _Nullable * _Nullable)error;
    
  2. func outputSettingsToFile(_ templateName:String, file:String) throws -> BOOL
    

Parameters

templateName: The name of the template that you want to output.
file: The file path and name where the template will be output and saved.
error: An NSError pointer. If an error occurs, it will represent the error information.

Error

Error Code Value Description
EC_FILE_SAVE_FAILED -10058 The file path is unavailable or the file can’t be created for any other reasons.
EC_CALL_REJECTED_WHEN_CAPTURING -10062 Function call is rejected when capturing in progress.

Return Value

A BOOL value that indicates whether the template is output successfully.

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest version
    • Version 2.x
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
      • Version 2.2.10
      • Version 2.0.21
      • Version 2.0.20
      • Version 2.0.10
    • Version 1.x
      • Version 1.2.1
      • Version 1.2.0
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
      • Version 1.1.13
      • Version 1.1.12
      • Version 1.1.11
      • Version 1.1.9
      • Version 1.1.8
      • Version 1.1.7
      • Version 1.1.6
      • Version 1.1.5
      • Version 1.1.4
      • Version 1.1.3
      • Version 1.1.2
      • Version 1.1.1
      • Version 1.1.0
      • Version 1.0.0
      • Version 1.0.4
      • Version 1.0.3
      • Version 1.0.2
      • Version 1.0.1
      • Version 1.0.0
    Change +
    © 2003–2024 Dynamsoft. All rights reserved.
    Privacy Statement / Site Map / Home / Purchase / Support