Last Modified October 2, 2026

Adding software_DNA to XCode

  1. Overview
  2. Considerations with Code Signing and App Sandbox
  3. Supporting multiple MAC Users (V6.00)

 

  1. Copy the libdna.dylib and DNA_INT files to the root directory of your Project. Use the DNA_INT file appropriate for your programming language.
  2. While viewing the "Project Navigator" window :
    • select from the top menu File -> Add File to <name> and add the above files to your project

    • XCode Add to Project
    • you can then move the files in the "Project Navigator" to organize your project, for example:

      • in ObjC project, move the DNA_INT files to the "Other Sources" folder and the libdna.dylib file to the "Resources" folder
      • in Swift project, you can leave all files in the root project directory, or any sub-directories you have

      Project in Obj-C


      XCode Move files

      Project in Swift


      XCode Move files
  3. under the TARGETS -> <appName> -> Build Phases -> Embed Libraries:
    • add a Embeded Library (click on + and select the libdna.dylib file in your project)
    • select Destination Executables
    • disable Copy only when installing
    • disable Code Sign on Copy if you want to authenticate the DNA Library Hash. Your project settings may not allow this, in which case, do not authenticate the DNA Library in your App.
    Add Build Phase
  4. if building a SWIFT App, you will need to add a Bridging Header for the DNA_INT C-based files:
    • using File -> New -> File, click on "Header File" and name it: <appname>-Bridging-Header
    • in the Header file, add the following:
      • #import "dna_int.h"
      • #import <CommonCrypto/CommonDigest.h> // this is used for SHA256 check of library, optional
    Add to Bridging Header
  5. For Objective-C projects, you will need to add #import "dna_int.h" statement to any source file that will be using the DNA API calls XCode Obj-C import
  6. for some projects, and if building a SWIFT App, you will need to add RunPaths in the "Linking" configuration of your project:
    • under the TARGETS -> <appName> -> Build Settings -> Linking (this links the Library in the Package Contents of the App)
    • add a Runpath Search Paths for both Debug and Release:

      @loader_path

    Add Build Phase

You should now be able to add DNA API calls in your project as per our Implementation Guides.

 

 

Considerations with Code Signing and App SandBox

Code Signing, and App Sandbox are important requirements if you plan on distributing your Application via the Apple Store, and/or if you want to ensure no warnings are issued when your Users downloaded your Application from the Apple Store or a 3rd party e-commerce solution.

Impacts of Code Signing

With code signing, it is not required to authenticate the libdna.dylib.

Impacts of App Sandbox
  • when App Sandbox is enabled, the Package Contents directory cannot be modified at run-time, and the CDM License file cannot be stored in this location.
  • when App Sandbox is enabled, ensure the following settings are enabled:
    • Network -> Incoming Connections
    • Network -> Outgoing Connections
Without Code Signing

Calculate the hash signature of the libdna.dylib file and compare against the unShuffled (unsigned) hash value provided with the DNA Library

 

Supporting multiple MAC Users (V6.00)

To allow different Users on the same MAC computer to share the same License Code:

  • use a Multi-Computer or Multi-User License
  • set up the DNA Properties as follows:
    • DNA_SetProperties("CDMPathName","/Users/"+NSUserName()+"/Library/Application Support/<app_name>/<app_name>.CDM")
    • DNA_SetProperties("userID",NSUserName())
    The NSUserName() function will ensure each CDM License file is unique and specific to the MAC User

The Users sharing the same License may be on different computers.

Other locations that can be used:

/ Users / <userName> / <app_name> / <app_name>.CDM