react-native-nordic-dfu: Build Error on Version 3.0.0

I followed the instructions on README.md, down to adding SWIFT_VERSION = 5.0, but it says

Module 'iOSDFULibrary' not found

I’m currently using

react-native 0.58.6
Xcode 10.2.1

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I manage to build and run the project successfully. These are the steps I followed:

  1. Create the ios/Podfile before executing react-native link
  2. Add react-native-nordic-dfu and all other libraries you need to the Podfile
  3. Add to the Podfile all the React items located on the Libraries folder of the XCode project
platform :ios, "9.0"

# External dependencies contain Swift, important to add this line
use_frameworks!

target "project" do

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    # the following ones are the ones taken from "Libraries" in Xcode:
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]


  # Standard React Native dependencies when using CocoaPods
  pod "yoga", path: "../node_modules/react-native/ReactCommon/yoga"
  pod "DoubleConversion", podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
  pod "glog", podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
  pod "Folly", podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"

  pod "react-native-ble-manager", path: "../node_modules/react-native-ble-manager"
  pod "react-native-fetch-blob", path: "../node_modules/react-native-fetch-blob"

  # replace this path with "../node_modules/react-native-nordic-dfu" or wherever
  # it's installed in your project
  pod "react-native-nordic-dfu", path: "../node_modules/react-native-nordic-dfu"

  # Add here other libraries
end
  1. Execute react-native link
  2. Execute pod install
  3. Open the project xcworkspace created by the pod install
  4. Remove all the items located on the Libraries folder in the XCode project (remove references). (I don’t know what would happen if there’s a librarie that can not be add to the Podfile, I suppose that you shouldn’t delete it from the Libraries folder, however it might fail looking for references)
  5. Set Always Embed Swift Standard Libraries on the target project in Build Settings (I’m not sure this is required but in older versions this was a step required to use the iOSDFULibrary)
  6. Set SWIFT_VERSION to the required value for your XCode, I added this to the end of the Podfile because I needed the version 4.2:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'
    end
  end
end
  1. Build and execute

@SebastianGrzymala Thanks, I’ve updated the README with this in mind

@Looveh I managed to run the example project only when update the Xcode. SWIFT version 5 was implemented in 10.2 which is very new. I think you should update readme to use minimum this version.