我正在玩iBeacons,我想在特定信标在范围内时执行一次函数或命令。这是我的代码:https://gist.github.com/Silvering/f3dc4edf32eb55afe433 当信标在范围内时,我收到“它的紫色”x10000 我只想一次显示这条消息..有什么想法吗?
答案 0 :(得分:1)
为此,你基本上可以做两件事
类似于:
// Create storage for located beacons
var locatedBeacons = [Int]()
// Adds beacon to storage
func beaconLocated(beaconId : Int) {
self.locatedBeacons.append(beaconId)
}
// Already located?
func isBeaconLocated(beaconId : Int) -> Bool {
return contains(self.locatedBeacons, beaconId)
}