If i have a device acting as a receiver and it connects to an iBeacon, what would happen if it connected to another iBeacon whilst still processing the connection to the first (e.g. Hadn't finished the running the didEnterRegion method)? Does the framework automatically handle this and create another sort of 'instance' or could I run into problems?
Thanks
If
CoreLocation
detects two different region entry events in quick succession, it is certainly possible that two threads will execute your delegate'sdidEnterRegion
simultaneously. So, yes, you could run into problems.For this reason, you should be careful to:
Design your code in that method so that it will function properly if executed in simultaneous threads.
Design your code in that method so it exits quickly. Any long-running processing should be done in a new thread.
While the question mentions "connected to another iBeacon", it is important to understand there is no actual connection -- beacons are transmit only devices, and iOS will passively look for them and send delegate callback methods based on starting to see them, or no longer seeing them.