swift - Actions executed multiple time iBeacon -
i'm playing ibeacons , execute function or command 1 time when specific beacon in range. here code: https://gist.github.com/silvering/f3dc4edf32eb55afe433 when beacon in range, receive "its purple" x10000 want display message 1 time.. idea?
for that, there 2 things can do
- remove location delegate after locate beacon, not receive more calls
- remember located beacon (for example, in array) , expand logic condition skip in case should presented multiple time.
so like:
// create storage located beacons var locatedbeacons = [int]() // adds beacon storage func beaconlocated(beaconid : int) { self.locatedbeacons.append(beaconid) } // located? func isbeaconlocated(beaconid : int) -> bool { return contains(self.locatedbeacons, beaconid) }
Comments
Post a Comment