Tag: 地区

如何在Objective-C中使用startMonitoringForRegion扫描多个区域

我已经经历了两个教程,正在阅读基本的C语言。在过去一周左右的时间里,通过学习做了最好的学习,并写了一些轻量级的应用程序。 赶快写一些将使用ibeacon的应用程序。 正如我正在通过一些样本,阅读参考指南,我看到,可以扫描多个区域通过运行startMonitoringForRegion为每个UUID。 好的,所以我想我可以运行它为每个UUID,但这是行不通的。 我敢肯定,我正在做一些基本上完全错误的东西…下面的代码是一个彻头彻尾的破解 – 一旦我得到的语义,我将从一个数据库调用API的UUIDs,并通过它们来激活监控。 下面的代码在最后一个循环中仅显示四个UUID中的两个。 在标题中: @property (strong, nonatomic) CLBeaconRegion *myBeaconRegion; @property (strong, nonatomic) CLBeaconRegion *myBeaconRegion2; @property (strong, nonatomic) CLBeaconRegion *myBeaconRegion3; @property (strong, nonatomic) CLBeaconRegion *myBeaconRegion4; 主要: NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"86E4BDEA-C6FF-442C-95CB-E6E557A23CF2"]; self.myBeaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.appcoda.testregion"]; NSUUID *uuid2 = [[NSUUID alloc] initWithUUIDString:@"C9AFF296-A722-4F2D-8669-47B7CCC79A14"]; self.myBeaconRegion2 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid2 identifier:@"com.appcoda.testregion"]; NSUUID […]