我希望在特定时间进行区域监控。我有特定的活动时间,所以我想检查用户是否在该特定时间内在该地区
答案 0 :(得分:1)
您可以向应用发送无声推送通知,该通知会在您需要时将其唤醒。 (你需要一个远程服务器来执行此操作。还有大量服务可以发送推送消息,因此您需要自己编写)
这是我知道的appstore-safe方式的唯一方式
- (void)receivedNotification:(id)pushMessage {
//this will trigger the delegate to be called, check against the region there
[self.locationManager startUpdateLocations];
}
答案 1 :(得分:0)
只需设置在特定时间关闭的计时器并开始区域监控。例如,您可以监控信标区域,
_locationManager = [[CLLocationManager alloc]init];
_locationManager.delegate = self;
[_locationManager requestAlwaysAuthorization];
NSUUID *uuid = [[NSUUID alloc]initWithUUIDString:@"FDA50693-A4E2-4FB1-AFCF-C6EB07647825"];
CLBeaconRegion *region = [[CLBeaconRegion alloc]initWithProximityUUID:uuid identifier:@"skyBeacons"];
self.myregion =region;
self.myregion.notifyOnEntry= YES;
self.myregion.notifyOnExit =YES;
[_locationManager startMonitoringForRegion:self.myregion];
然后您可以使用位置管理器委托来捕获用户/区域。