【发布时间】:2014-06-03 07:50:09
【问题描述】:
我有一个 iBeacon 配置为:
NSUUID *proximityUUID = [[NSUUID alloc] initWithUUIDString:kUUID];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:proximityUUID identifier:kIdentifier];
self.beaconRegion.notifyEntryStateOnDisplay = NO;
self.beaconRegion.notifyOnEntry = YES;
self.beaconRegion.notifyOnExit = YES;
当我的应用关闭并且设备被锁定时,didEnterRegion 永远不会被触发:
locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{
[self sendLocalNotificationForBeaconRegionHello:(CLBeaconRegion *)region];
}
- (void)sendLocalNotificationForBeaconRegionHello:(CLBeaconRegion *)region
{
UILocalNotification *notification = [UILocalNotification new];
notification.alertBody = [NSString stringWithFormat:@"Welcome - %@", region.identifier];
notification.alertAction = NSLocalizedString(@"View", nil);
notification.soundName = UILocalNotificationDefaultSoundName;
notification.fireDate = nil;
notification.hasAction = false;
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
}
即使应用程序已关闭且手机已锁定,也会调用 didExitRegion。我只有在解锁手机时进入区域时才会收到通知。
任何想法可能是什么问题?
谢谢
【问题讨论】:
-
你在开始序列的某个地方使用了钥匙串吗?
-
钥匙串是什么意思?
-
keychain = 苹果的安全密码存储
-
不,我不在我的应用中使用钥匙串。
标签: ibeacon