Skip to content

Commit

Permalink
Merge pull request #59 from GaelleJoubert/patch-1
Browse files Browse the repository at this point in the history
Fix for Issue #58 - Breaking Change in IOS lib
  • Loading branch information
juliansteenbakker authored Sep 28, 2022
2 parents de97181 + 2e20ed1 commit 043dc17
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ios/Classes/SwiftNordicDfuPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public class SwiftNordicDfuPlugin: NSObject, FlutterPlugin, FlutterStreamHandler
return
}

guard let firmware = DFUFirmware(urlToZipFile: URL(fileURLWithPath: filePath)) else {
result(FlutterError(code: "DFU_FIRMWARE_NOT_FOUND", message: "Could not dfu zip file", details: nil))
return
}
do{
let firmware = try DFUFirmware(urlToZipFile: URL(fileURLWithPath: filePath))



let dfuInitiator = DFUServiceInitiator(queue: nil)
.with(firmware: firmware);
Expand All @@ -130,6 +130,11 @@ public class SwiftNordicDfuPlugin: NSObject, FlutterPlugin, FlutterStreamHandler
deviceAddress = address

dfuController = dfuInitiator.start(targetWithIdentifier: uuid)
}
catch{
result(FlutterError(code: "DFU_FIRMWARE_NOT_FOUND", message: "Could not dfu zip file", details: nil))
return
}
}

// MARK: DFUServiceDelegate
Expand Down

0 comments on commit 043dc17

Please sign in to comment.