E4 for Developers > E4 link for iOS

E4 link SDK

for iOS Development

Updated April, 2018

The steps described below assume you are adding the E4link Framework to an existing project, or you can also create a new project based on the available example projects.

Download our Xcode example project, already configured for use with the E4link Framework and start using your Empatica E4 wristband in a matter of minutes. Sample Xcode project (code is written in Swift 4)

While using our sample projects, you are just required to use your API Key in the ViewController.swift source file just replacing the "ADD_YOUR_KEY_HERE" const value.

Step 1

Project Setup

  1. Download the E4link.framework for iOS from your Developer Area in Empatica Connect.

  2. Open your existing project.

  3. Drag the E4link.framework into your project's "Frameworks" folder.

NOTE Make sure the "Copy items into destination group's folder (if needed)" checkbox is checked.

Step 2


The final steps to set up the API require adding a few lines of code to your main app delegate. Being the class where you include iOS required methods like applicationDidFinishLaunching.

Import the E4link header

At the top of your app delegate source file - and anywhere you invoke the DeviceManager class, you’ll need to include the correct E4link header.

Simply add this line in your AppDelegate.h or in the Swift bridging header .h file

  #import <E4link/E4link.h>

Set Your Empatica API Key

The E4 link API requires your developer key in order to make any requests to the API. Call this method with your API key when launching your app, adding the following code to your app delegate source file usually AppDelegate.swift:

  DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async {

      EmpaticaAPI.authenticate(withAPIKey: ViewController.EMPATICA_API_KEY) { (status, message) in

          if status {

              // "Authenticated" here you can start discovering devices

Step 3

Use the E4 link

Now you are ready to start using the E4 link in your project., Your main view controller - for example, in the default single view app, ViewController.swift must implement the EmpaticaDelegate and EmpaticaDeviceDelegate protocols.

  class ViewController: UITableViewController {

      // ...

  extension ViewController: EmpaticaDelegate, EmpaticaDeviceDelegate {

      // ...

Scan for devices


  private var devices: [EmpaticaDeviceManager] = []

  // ...

  private func discover() {

      EmpaticaAPI.discoverDevices(with: self)

  // ...

  extension ViewController: EmpaticaDelegate {

    func didDiscoverDevices(_ devices: [Any]!) {



        self.devices.append(contentsOf: devices as! [EmpaticaDeviceManager])

        DispatchQueue.main.async {


Connect to a device

  override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

      // Remember to stop discovering before connecting

      let device = self.devices[indexPath.row]

      if !device.isFaulty && device.allowed {

          device.connect(with: self)

Receiving samples with EmpaticaDeviceDelegate protocol

  func didReceiveGSR(_ gsr: Float, withTimestamp timestamp: Double, fromDevice device: EmpaticaDeviceManager!) {

    print("\(device.serialNumber!) GSR { \(abs(gsr)) } @ \(timestamp)")

    DispatchQueue.main.async {

      self.gsrLabel.text = "\(String(format: "%.2f", abs(gsr))) µS"