Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The CLBeaconRegion string identifier has nothing to do with the ids in iBeacon transmissions. It is simply a lookup key used by CoreLocationManager for keeping track of multiple regions. </p> <p>You can make its value whatever you want, but people often use a package-style qualifier because it is an easy way to make an app-specific unique string. </p> <p>The main purpose of the id comes if you want to modify or stop ranging/monitoring of your region. By using the same id, CoreLocation knows exactly which region you are referring to. </p> <p>In the example below, we construct region1, then start monitoring for it. We then change the minor identifier that we are monitoring for in region2 and start monitoring for that. Because the exact same string identifier is used in region1 and region2, CoreLocation knows to <em>replace</em> the first monitored region with the second one. </p> <pre><code>CLBeaconRegion *region1 = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major: 1 minor: 1 identifier: @"my.made.up.unique.identifer]; [_locationManager startMonitoringForRegion:region1]; CLBeaconRegion *region2 = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major: 1 minor: 2 identifier: @"my.made.up.unique.identifer]; [_locationManager startMonitoringForRegion:region2]; </code></pre> <p>This is most commonly used to stop monitoring for a region. Like this:</p> <pre><code>CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:[[NSUUID alloc] initWithUUIDString:@"2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6"] major: 1 minor: 1 identifier: @"another.made.up.unique.identifer]; [_locationManager startMonitoringForRegion:region]; ... [_locationManager stopMonitoringForRegion:region]; </code></pre> <p>In this second example where we stop region monitoring, it is really that string identifier inside the region object that is important in getting CoreLocation to stop monitoring that region.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload