我正在尝试连接5个iBeacon设备(Minew i10),并且只有当Major和Minor值都为0时,我才能发现它们。所有UUID都相同。我正在打印信标信息,并且仅当Major / Minor值不为0时才获得空白输出,而当BOTH Major / Minor值均设置为0时,只有范围,UUID,minor,major等的实际输出。
我在这里可能做错了什么?
import UIKit
import SceneKit
import ARKit
import CoreLocation
class ViewController: UIViewController, ARSCNViewDelegate, CLLocationManagerDelegate {
@IBOutlet var sceneView: ARSCNView!
let locationManager = CLLocationManager()
let region = CLBeaconRegion(uuid: UUID(uuidString: "(actual UUID inserted here)")!,
identifier: "Minew Beacon(s)")
override func viewDidLoad() {
super.viewDidLoad()
// Set the view's delegate
sceneView.delegate = self
locationManager.delegate = self
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedWhenInUse) {
locationManager.requestWhenInUseAuthorization()
}
locationManager.startRangingBeacons(in: region)
// Show statistics such as fps and timing information
sceneView.showsStatistics = true
// Create a new scene
let scene = SCNScene(named: "art.scnassets/ship.scn")!
// Set the scene to the view
sceneView.scene = scene
}
func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
print(beacons)
}
[您可能会尝试使用其他信标或带有信标发送器应用程序的第二部电话,例如适用于iOS的Locate Beacon或适用于Android的BeaconScope的信标发送器应用程序。
我怀疑您会发现您的代码没有问题,并且您将能够检测到具有非零大和小值的信标发送器。我怀疑是Minew信标配置,当您进行配置更改以将主要和次要设置为非零值时,某种程度上使该信标无法检测。可能是由于您应用的配置与预期的更改不同而导致配置方式出了问题。