Open vegetablesalad opened 5 years ago
Seems that this should be the correct way to go: But it still doesn't return any results
public func initialize() {
HCKBeaconCentralManager.sharedInstance().scanDelegate=self
HCKBeaconCentralManager.sharedInstance().stateDelegate=self
HCKBeaconCentralManager.sharedInstance().startScaniBeacons()
}
As per suggestion I added a delay before scanning. It doesn't resolve the issue:
import mokoBeaconSDK
@objc(BeaconScanner) class BeaconScanner : HCKBeaconCentralManager,HCKCentralStatesChangedDelegate,HCKCentralScanDelegate {
public func centralManagerStateChanged(_ managerState: HCKBeaconCentralManagerState, manager: HCKBeaconCentralManager!) {
print(" centralManagerStateChanged")
}
public func peripheralConnectStateChanged(_ connectState: HCKBeaconConnectStatus, manager: HCKBeaconCentralManager!) {
print(" peripheralConnectStateChanged")
}
public func centralManagerScanNewDeviceModel(_ beaconModel: HCKBeaconBaseModel!, manager: HCKBeaconCentralManager!) {
print(" centralManagerScanNewDeviceModel")
}
public func centralManagerStartScan(_ manager: HCKBeaconCentralManager!){
print(" centralManagerStartScan")
}
public func centralManagerStopScan(_ manager: HCKBeaconCentralManager!){
print(" centralManagerStopScan")
}
public func initialize() {
let instance = HCKBeaconCentralManager.sharedInstance()
instance?.scanDelegate=self
instance?.stateDelegate=self
DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
print(" start scan")
instance?.startScaniBeacons()
}
}
}
I'm having some issues in replicating code in swift: Am I missing something ?