ESTbeaconMangerDelegate没有在swift中调用函数

时间:2014-10-08 13:30:23

标签: swift ibeacon

全部,

我添加了头文件并在Swift中添加了用于估计信标的SDK。但是当我运行这个简单的代码时,不会调用func didRangeBeacons。有任何想法吗 ?

class ViewController: UIViewController, ESTBeaconManagerDelegate {

    let BeaconManager : ESTBeaconManager = ESTBeaconManager()

    override func viewDidLoad() {
        super.viewDidLoad()

    // set beacon manager delegate
    BeaconManager.delegate = self
    var beaconRegion : ESTBeaconRegion = ESTBeaconRegion(proximityUUID: NSUUID(UUIDString: "B9407F30-F5F8-466E-AFF9-25556B57FE6D"), identifier: "Icy Marshmallow")
    BeaconManager.startRangingBeaconsInRegion(beaconRegion)

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


    func beaconManager(manager: ESTBeaconManager, didRangeBeacons: [ESTBeacon], inRegion: ESTBeaconRegion) {

        println("Found \(didRangeBeacons.count) in range");
    }

1 个答案:

答案 0 :(得分:0)

确保使用estimotecloudmanager登录estimotecloud。将登录代码放在AppDelegate Didlaunchwithoptin方法中。