iOS 13 - Estimote SDK - Beacon ranging

耗尽温柔 提交于 2019-12-11 18:48:53

问题


I've encountered problem with beacon ranging in iOS 13

Ranging Nearable stickers stop working

self.nearableManager.startRanging(forIdentifier: nearableIdentifier)

Nothing happens in delegate method:

func nearableManager(_ manager: ESTNearableManager, didRangeNearable nearable: ESTNearable) { }

UPDATE Error found:

Ranging nearables failed with error: Error Domain=com.estimote.nearables Code=301 "Blueooth is not powerd on." UserInfo={NSLocalizedDescription=Blueooth is not powerd on.}

When I use CBCentralManager() then in its delegate I am getting poweredOn status

func centralManagerDidUpdateState(_ central: CBCentralManager) {

        switch central.state {
          case .unknown:
            print("central.state is .unknown")
          case .resetting:
            print("central.state is .resetting")
          case .unsupported:
            print("central.state is .unsupported")
          case .unauthorized:
            print("central.state is .unauthorized")
          case .poweredOff:
            print("central.state is .poweredOff")
          case .poweredOn:
            print("central.state is .poweredOn")
        }
    }



private init(rangingTimeout: TimeInterval? = nil) {
        super.init()
        self.centralManager = CBCentralManager(delegate: self, queue: DispatchQueue.main)

        self.nearableManager.delegate = self
        self.rangingTimeout = rangingTimeout

        self.beaconManager.delegate = self
        self.beaconManager.requestAlwaysAuthorization()
    }

All this code is used in singleton object used on multiple screens of application.

class NearableTablesManager : NSObject {

    // MARK: - Singleton
    private static var shared : NearableTablesManager?

    static func shared(rangingTimeout: TimeInterval? = nil) -> NearableTablesManager {

        if shared == nil {
            shared = NearableTablesManager(rangingTimeout: rangingTimeout)
        }

        return shared!
    }

来源:https://stackoverflow.com/questions/58137280/ios-13-estimote-sdk-beacon-ranging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!