Swiftpack.co - Package - NordicSemiconductor/IOS-Pods-DFU-Library

iOS DFU Library

Version Carthage compatible


For Cocoapods:

  • Create/Update your Podfile with the following contents

    target 'YourAppTargetName' do
        pod 'iOSDFULibrary'
  • Install dependencies

    pod install
  • Open the newly created .xcworkspace

  • Import the library to any of your classes by using import iOSDFULibrary and begin working on your project

For Carthage:

  • Create a new Cartfile in your project's root with the following contents

    github "NordicSemiconductor/IOS-Pods-DFU-Library" ~> x.y //Replace x.y with your required version
  • Build with carthage

    carthage update --platform iOS //also OSX platform is available for macOS builds
  • Carthage will build the iOSDFULibrary.framework and ZipFramework.framework files in Carthage/Build/, you may now copy all those files to your project and use the library, additionally, carthade also builds *.dsym files if you need to resymbolicate crash logs. you may want to keep those files bundled with your builds for future use.

For Swift Package Manager:

// swift-tools-version:5.1
import PackageDescription

let package = Package(
  name: "<Your Product Name>",
  dependencies: [
      url: "https://github.com/NordicSemiconductor/IOS-Pods-DFU-Library", 
      .upToNextMajor(from: "<Desired Version, e.g. 4.7.2>")
  targets: [.target(name: "<Your Target Name>", dependencies: ["NordicDFU"])]

Device Firmware Update (DFU)

The nRF5x Series chips are flash-based SoCs, and as such they represent the most flexible solution available. A key feature of the nRF5x Series and their associated software architecture and S-Series SoftDevices is the possibility for Over-The-Air Device Firmware Upgrade (OTA-DFU). See Figure 1. OTA-DFU allows firmware upgrades to be issued and downloaded to products in the field via the cloud and so enables OEMs to fix bugs and introduce new features to products that are already out on the market. This brings added security and flexibility to product development when using the nRF5x Series SoCs.

This repository contains a tested library for iOS 8+ platform which may be used to perform Device Firmware Update on the nRF5x device using an iPhone or an iPad.

DFU library has been designed to make it very easy to include these devices into your application. It is compatible with all Bootloader/DFU versions.

Alt text for your video

Service Changed characteristic

In order the DFU to work with iOS, the target device MUST have the Service Changed characteristic with Indicate property in the Generic Attribute service. Without this characteristic iOS will assume that services of this device will never change and will not invalidate them after switching to DFU bootloader mode.

Service Changed characteristic behaviour:
  • On paired devices a change of the attribute table must be indicated using an indication to the Service Changed characteristic. iOS automatically enables the CCC and handles this indication and performs a service discovery. This indication is handled correctly in Legacy DFU since SDK 8.0.
  • On non-trusted devices (not paired) iOS will clear the service cache every time the device disconnects.
Secure DFU from SDK 12:
  • The Secure DFU implementation from SDK 12 does not support bonding (experimental buttonless sample does not pass bond information when switching to DFU bootloader mode and the bootloader does not send S-C indication). As a workaround, the bootloader starts to advertise with MAC address incremented by 1, so from the phone's perspective it's a completly new device and a fresh service discovery will be done. When your new firmware is going to change the list of services you may consider adding another 1 to the MAC address for the new application to make sure the cache will not conflict (unless the device is not bonded and you have Service Changed characteristic, then no caching is used as written above). Be aware, that adding 1 to a public address is not possible (unless you register a new one). Also, devices may be sold with following MAC addresses and it may happen that 2 devices have the same one. Use this feature carefully.
Secure DFU from SDK 14:
  • Buttonless DFU with Bonds Sharing has been added to the SDK. Bonded relationship is required to use this service. Address does not change when in DFU mode, instead the bootloader sends Service Changed indication when entered DFU mode and app mode. For bonded devices it is recommended to use this service.


See the documentation for more information.


The library is compatible with nRF51 and nRF52 devices with S-Series Soft Device and the DFU Bootloader flashed on.

DFU History

Legacy DFU

  • SDK 4.3.0 - First version of DFU over Bluetooth Smart. DFU supports Application update.
  • SDK 6.1.0 - DFU Bootloader supports Soft Device and Bootloader update. As the updated Bootloader may be dependent on the new Soft Device, those two may be sent and installed together.
  • Buttonless update support for non-bonded devices.
  • SDK 7.0.0 - The extended init packet is required. The init packet contains additional validation information: device type and revision, application version, compatible Soft Devices and the firmware CRC.
  • SDK 8.0.0 - The bond information may be preserved after an application update. The new application, when first started, will send the Service Change indication to the phone to refresh the services. New features:
  • Buttonless update support for bonded devices
  • sharing the LTK between an app and the bootloader.

Secure DFU

  • SDK 12.0.0 - New Secure DFU has been released. This library is fully backwards compatible so supports both the new and legacy DFU.
  • SDK 13.0.0 - Buttonless DFU (still experimental) uses different UUIDs. No bond sharing supported. Bootloader will use address +1.
  • SDK 14.0.0 - Buttonless DFU no longer experimental. New buttonless characteristic added for bonded devices (requires bond, cache cleaning relies on Service Changed indication).
  • SDK 15.0.0 - Support for higher MTUs added.

This library is fully backwards compatible and supports both the new and legacy DFU. The experimental buttonless DFU service from SDK 12 is supported since version 1.1.0. Due to the fact, that this experimental service from SDK 12 is not safe, you have to call dfuInitiator.enableUnsafeExperimentalButtonlessServiceInSecureDfu = true to enable it, this is off by default. Read the method documentation for details. It is recommended to use the Buttonless service from SDK 13 (for non-bonded devices, or 14 for bonded). Both are supported since DFU Library 1.3.0.

Check platform folders for mode details about compatibility for each library.

React Native

An unofficial library for both iOS and Android that is based on this library is available for React Native: react-native-nordic-dfu


A library for both iOS and Android that is based on this library is available for Flutter: flutter-nordic-dfu



Stars: 302


Used By

Total: 0


4.7.2 - 2020-05-13 08:50:43

Bugs fixed:

  • Carthage build fixed (#370).
  • Reporting error when Bluetooth is turned off during upload (#371).

4.7.1 - 2020-04-07 16:17:47

Bugs fixed:

  • Library will not assume that unintended disconnection when setting alternative advertising name did jump to bootloader mode (#365).
  • Tests for nRF52840 fixed.

4.7.0 - 2020-04-03 20:07:17


  • Migration to Swift 5.2. The code should be compatible with older Swift versions, up to 4.2.

4.6.1 - 2019-11-14 14:34:20

Bugs fixed:

  • Improved DFU stability for latest SDKs (#349)
  • Wrong queue was used to delay operation
  • Minor issue fixed in the sample app


  • DFU tests added for SDK 15.3 and 16

4.6.0 - 2019-11-01 10:33:43

New features:

  • Automatic retrying DFU on disconnection during update (#332).


  • The sample app has been modified to work on iOS 13.

Bugs fixed:

  • Some delegates were called on a wrong queue (#339).
  • DFU from SDK 6.0 fixed. PRN is forced set to 1.

4.5.1 - 2019-08-21 11:39:05

Bugs fixed:

  • Issue with DFU on iOS 13, where the CBPeripheral could not be retrieved (#322).


  • Migrated to Xcode 10.3.

4.5.0 - 2019-08-07 08:59:41


  • Hex to Bin Converter rewritten in Swift 5 (#311)
  • Option to specify an alternative advertising name (#304), thanks to @jlubawy
  • SPM support (#310) (as NordicDFU), thanks to @DevAndArtist

4.4.2 - 2019-04-23 13:00:16

Issues fixed:

  • #297 - adding missing buttonless service statuses
  • #295 - adding support for older Swift versions
  • ZIPFoundation dependency bound to 0.9.9.

4.4.1 - 2019-04-12 12:59:15

Bugs fixed:

  • #288 - fixed parsing UInt32 out of Data.
  • #281 - hopefully fixed Carthage issue.

4.4.0 - 2019-04-03 14:59:11

Version 4.4.0 includes:

  • Migration to Swift 5
  • New App Store icon to silence the warming
  • Name conflict fixing between DFU Library and ZIPFramework
  • Fixed total progress indicator in the sample app

4.3.0 - 2019-03-01 16:05:14

This release brings the following changes to iOSDFULibrary:


  • Zip dependency switched to ZipFramework (#251).
  • Dispatching delegates in designated queues (#249).
  • Added option to disable resuming Secure DFU operation (#264).
  • Attempt to send an App when SD+BL update failed with remote error (#266).
  • Extended errors exposed (#262).
  • Modified look & feel of the Sample app.

Bug fixes:

  • Fixed a crash during restarting DFU (#269).
  • Fixed resuming Secure DFU on SDK 15 (#270).
  • Typos in 2 error constants fixed (#263).
  • Restarting DFU fixed in Sample app.

4.2.2 - 2018-11-01 09:16:38

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • Fixed issue #245 where the DFUError operationFailed was not reported.

4.2.1 - 2018-10-09 09:05:55

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • Fixed issue causing a crash when the target peripheral was set to nil and discoverServices() got called. resolves issue #200
  • Raised MacOS Deployment target to 10.14 due to missing identifier property on CBPeripheral to avoid hacks and workarounds for now.

4.2.0 - 2018-10-05 13:49:00

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • DFU no longer takes control over delegates.
  • Added more DFU automated tests, covering SDK 15 and 15.2 + some older SDKs due to a MBR workaround.
  • Improved error handling.
  • The previous ZIP files from SDK 14+ had bootloaders with disabled Service Changed characteristic.
  • Bugfix: Fixed memory cycle caused by a strong delegate reference.
  • Bugfix: Fixed update failures because of device disconnects.


  • Migrated to Swift 4.2.
  • UUID Helper that allows using custom service identifiers for DFU.
  • Jazzy Docs can now be easily generated.
  • Added more logging to services on not supported devices.
  • Refactoring and comments have been improved.

4.1.3 - 2018-04-23 07:12:48

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • Fix by @simonseyer that resolves a random disconnects issue caused by the reuse of the same CBCentralManager used by the library, which received callbacks of device disconnects that might not be the target peripheral.


  • Fix by @alanfischer that resolves an Xcode warning related to documentation.

4.1.2 - 2018-02-21 09:00:47

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • Fixed an issue introduced in 4.1.1 that caused legacy DFU to fail on some devices
  • Fixed missing information in the documentation that explains how to enable the experimental buttonless DFU feature


  • Added test suites in the example app, this is available via the pod try command. It allows to automate testing of the DFU library using bootloaders from different SDKs on nRF51, nRF52832 and nRF840. It also provides a way to automate testing of custom firmware chain upgrade (v1.0 -> v2.0 -> v3.0, etc..).

4.1.1 - 2018-01-22 12:12:50

This release brings the following changes to iOSDFULibrary:

Bug fixes:

  • Fixed an issue with DFU processes that had multiple DFU parts that caused the executor to connect to wrong peripherals after flashing the first part. The peripheral is now held in memory until it comes back online, so the library will no longer scan for DFU peripherals while waiting for it to restart.
  • Fixed an issue related to the new address expected flag.


  • Carthage support for MacOS.
  • Firmware size information is now available for Obj-C projects.
  • Added required imports for projects built without Cocoapods.

4.1.0 - 2017-12-11 10:22:19

This release brings the following changes to iOSDFULibrary:


  • Utilising iOS 11's new canSendWriteWithoutResponse API to remove the need of using packet receipt notifications (PRN).
    • To enable this feature, set a PRN value of 0 on an iOS 11 device.
    • PRN will still be used as the default option.
    • Note: Using this new API will cause a speed increase in writes, some older SDKs might not be able to handle such speed, so ensure that your peripheral is capable of handling this new API before deploying it.

4.0.3 - 2017-11-24 08:35:15

This release brings the following changes to iOSDFULibrary:


  • Added an option to disable bootloader mode rename feature in cases where it's not needed or causes an issue.


  • The current improvement fixes issue #159 where one user had an issue with updating their peripherals due to the enforced name change feature, so making it optional will resolve the issue.

Release 4.0.2 - 2017-09-28 10:56:43

This release brings the following changes to iOSDFULibrary:


Fixed issues #149 introduced in Version 4.0.0 that caused DFU process to fail due to a peripheral selector method returning false instead of true

4.0.1 - 2017-09-25 13:48:17

This release brings the following changes to iOSDFULibrary:


  • Exposed library methods to Objc based projects
  • Projects with Swift3 inference turned off will be able to work properly

4.0.0 - 2017-09-25 07:49:27

This release brings the following changes to iOSDFULibrary:

Swift 4.0 Support

3.2.1 - 2017-09-11 08:05:14

This release brings the following changes to iOSDFULibrary:

New Features :

  • Initialising DFUFirmware with Data (fixes issue #130)


  • Fixes in comments and minor typos.

3.1.0 - 2017-04-12 08:17:18

+Minor code refactor for Data struct manipulation +Workaround: Bootloader for SDK6.1, fixes issue #96 +New: buttonless service from SDK 13 supported +New: library prepared for future buttonless service with bond sharing

- 2016-12-06 12:52:20