更改 iBeacon 的 Minor 和 Major 值会阻止我找到信标。 (iBeacon/Xcode)
Changing Minor and Major values for iBeacon stops me from being able to find the beacon. (iBeacon/Xcode)
我正在尝试连接到 5 个 iBeacon 设备 (Minew i10),我只能在 Major 和 Minor 值都为 0 时才能发现它们。所有 UUID 都相同。我正在打印信标信息,只有当 Major/Minor 值不为 0 时才会得到空白输出,而当 Major/Minor 值都设置为 0 时,会得到包含范围、UUID、次要、主要等的实际输出。
我这里可能做错了什么?
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)
}
您可以尝试使用不同的信标或第二个 phone 使用信标发射器应用程序,例如 Locate Beacon for iOS 或 BeaconScope for Android.
我怀疑您会发现您的代码没有任何问题,并且您将能够检测到具有非零主值和次值的其他信标发射器。我怀疑是 Minew 信标配置在您进行配置更改以将主要和次要设置为非零值时以某种方式使该信标无法检测到。也许您配置它的方式有问题,应用的内容与预期更改不同。
我正在尝试连接到 5 个 iBeacon 设备 (Minew i10),我只能在 Major 和 Minor 值都为 0 时才能发现它们。所有 UUID 都相同。我正在打印信标信息,只有当 Major/Minor 值不为 0 时才会得到空白输出,而当 Major/Minor 值都设置为 0 时,会得到包含范围、UUID、次要、主要等的实际输出。
我这里可能做错了什么?
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)
}
您可以尝试使用不同的信标或第二个 phone 使用信标发射器应用程序,例如 Locate Beacon for iOS 或 BeaconScope for Android.
我怀疑您会发现您的代码没有任何问题,并且您将能够检测到具有非零主值和次值的其他信标发射器。我怀疑是 Minew 信标配置在您进行配置更改以将主要和次要设置为非零值时以某种方式使该信标无法检测到。也许您配置它的方式有问题,应用的内容与预期更改不同。