Installation Guide

1. Download DM SDK

Download DM SDK from the Digimarc Barcode Manager. Make sure you generate your API key at the same time.

Adding DM SDK to your project

Copy DMSDK.xcframework to your project by dragging it from the DM SDK folder into your Xcode project’s files.

Xcode will display a dialog confirming you want to add DM SDK to your project. Confirm that “Copy items if needed” is selected, and that your target is checked under “Add to targets.”

Obj-C only projects

If your application does not include any Swift source code, you’ll need to configure your project to include the Swift Standard Library.

In your application target, under the Build Options, set “Always Embed Swift Standard Libraries” to “Yes.”

If your deployment target has Swift built in, this option is unnecessary, and will be ignored automatically. Swift is built in starting in the following OS versions:

  • iOS 12.2
  • macOS 10.14.4
  • watchOS 5.2
  • tvOS 12.2

Adding required dependencies

Depending on your Xcode configuration, you may need to add new framework dependencies to your project. If you need to add a framework dependency, click on the Project file in Xcode and open the ‘General’ tab. Towards the bottom, select the framework you want to remove from “Linked Frameworks and Libraries” and click the ( + ) button. Select the framework from the list and click “Add”.

  • QuartzCore
  • CoreGraphics
  • AVFoundation
  • UIKit

2. Configuring Code Signing

  1. In your Project, click on the General tab and select your app’s target.
  2. Select DMSDK.xcframework from the list under the “Frameworks, Libraries, and Embedded Content” section.
  3. Under the Embed column, choose “Embed & Sign” from the dropdown menu options for DMSDK.xcframework.

3. Adding the API key

You can configure DM SDK’s API key when your application launches.

In your Application Delegate, import DM SDK.

Swift
import DMSDK
Obj-C
import <DMSDK/DMSDK.h>

Then, in applicationDidFinishLaunching, configure DM SDK with your API key. Replace “YOUR_API_KEY_GOES_HERE” with your API key.

Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    DMSDK.LicenseManager.APIKey = "YOUR_LICENSE_KEY_GOES_HERE"
    ...
}
Obj-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
    DMSLicenseManager.APIKey = @"YOUR_LICENSE_KEY_GOES_HERE";
    ...
}

Option 2: Adding the API key to your Info.plist

An API key can be added to an application with a DMSAPIKey Info.plist entry. This option does leave the key exposed in the Info.plist and is not recommended in situations where the API key is considered senstive.

Option 3: Pass the API key directly to class initializers

Classes that require an API, such as image/audio readers and the resolver, have an initializer varient that takes an API key parameter. Using this initializer allows a developer to use multiple API keys, or have greater control over how their application manages an API key. This intiailizer will fail if the API key is invalid.

Some classes in DM SDK are not reliant on an API key, such as DMSPayload/Payload. These classes will operate without a valid API key, and do not have an API key initializer.