问题
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