IOS-DFU-Library: Cannot connect with peripheral
Hi, I am developing application and trying to use this library to implement FOTA into it. I am using Swift 3.0 and testing everything on device with iOS 10. Peripheral is based on nRF51822 SoC.
Unfortunatelly library cannot connect with peripheral - stucks on “Connecting”.
I tried running initiator.start() method in different conditions (connected with the device, disconnected with the device, in DFU mode, in normal mode) nothing works. Do you have any idea what am I missing?
bluetooth.manager and bluetooth.connectedPeripheral are not nil.
My implementation:
let bluetooth = SensorManager.sharedInstance
self.downloadUpdateFile(uuid: forUUID) { (localFirmwareUrl) in
if let selectedFirmware = DFUFirmware(urlToZipFile: localFirmwareUrl) {
let initiator = DFUServiceInitiator(centralManager: bluetooth.manager, target: bluetooth.connectedPeripheral).withFirmwareFile(selectedFirmware)
initiator.packetReceiptNotificationParameter = 12
initiator.forceDfu = true
initiator.logger = self
initiator.delegate = self
initiator.progressDelegate = self
print("START")
let controller = initiator.start()
}
}
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (11 by maintainers)
@DannyWithJoy yes this is the expected behaviour since ObjC Uses ARC so you need to hold a reference to the controller object.
This is a bit irrelevant to that bug though, but thanks a lot for the tip, will surely help someone else