0

我正在尝试从 Xamarin iPad 应用程序中检测 Estimote iBeacons,但从未触发过“DidRangeBeacons”事件。

locationManager = new CLLocationManager();
var beaconId = new NSUuid("B9407F30-F5F8-466E-AFF9-25556B57FE6D");
beaconRegion = new CLBeaconRegion(beaconId, "Test Region");

locationManager.DidRangeBeacons +=  ( sender, e) => {
foreach (var beacon in e.Beacons) {
    Console.WriteLine(beacon.Major +"-"+ beacon.Minor +": " + beacon.Proximity +" " + beacon.Accuracy);
    }
};

locationManager.StartRangingBeacons (beaconRegion);
Console.WriteLine ("Starting Ranging"); 

上面的代码在 ViewDidLoad 方法中运行。

我是否需要配置其他任何东西来检测 iBeacons?

代码在 iPad 上运行,标准 Estimote 应用程序检测到 iBeacons

4

1 回答 1

2

这已通过在文件中添加“ NSLocationAlwaysUsageDescription”或“ NSLocationWhenInUseUsageDescription”来解决,plist.info位置服务在 iOS 8 中不起作用中所述

于 2014-10-15T12:03:44.303 回答