質問

Is it possible for an ios App to listen to multiple UUID's? Specifically for apples iBeacon technology.

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"23542266-18D1-4FE4-B4A1-23F8195B9D39"];
    self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.devfright.myRegion"];
    [self.locationManager startMonitoringForRegion:self.beaconRegion];

Using this code one could start monitoring the following uuid: 23542266-18D1-4FE4-B4A1-23F8195B9D39, if I would add another class listening to another uuid, would this work, wouldn't there be any interference? Maybe add several more listeners?

役に立ちましたか?

解決

You can listen up to 20 UUIDs per app. Simply create more CLBeaconRegions, and call startMonitoringForRegion: for each region you want to monitor. You only need a single CLLocationManager to do this.

Note that you will get a call to didEnterRegion: / didExitRegion: for each region you are monitoring. The region parameter will tell you which region you have entered.

Number of UUID limit source: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW2

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top