Estimote iBeacons 监控无法在 iOS 9.0.2 上运行

Posted

技术标签:

【中文标题】Estimote iBeacons 监控无法在 iOS 9.0.2 上运行【英文标题】:Estimote iBeacons Monitoring not working on iOS 9.0.2 【发布时间】:2015-11-04 07:40:19 【问题描述】:

我正在使用 estimote 信标及其 SDK 进行信标监控和测距。测距在 ios 8.4 和 iOS 9.0.2 上运行良好。虽然监控仅适用于 iOS 8.4,但在进入和离开区域时,我在 iOS 9.0.2 上没有收到任何通知。

这是我在应用程序委托中使用的代码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    // Override point for customization after application launch.

    ...


    self.beaconRegion = [[CLBeaconRegion alloc]
                         initWithProximityUUID:[[NSUUID alloc]
                                                initWithUUIDString:@"myUUID"]
                         major:12345 minor:12345 identifier:@"mint"];
    self.beaconRegion1 = [[CLBeaconRegion alloc]
                         initWithProximityUUID:[[NSUUID alloc]
                                                initWithUUIDString:@"myUUID"]
                         major:12334 minor:12345 identifier:@"ice"];
    self.beaconRegion2 = [[CLBeaconRegion alloc]
                         initWithProximityUUID:[[NSUUID alloc]
                                                initWithUUIDString:@"myUUID"]
                         major:1234 minor:1234 identifier:@"blueberry"];

    self.beaconManager = [ESTBeaconManager new];
    self.beaconManager.delegate = self;
    self.locManager.allowsBackgroundLocationUpdates = YES;
    self.locManager.pausesLocationUpdatesAutomatically = NO;
    [self.locManager requestAlwaysAuthorization];

    [self.locManager startMonitoringForRegion:self.beaconRegion];


    self.beaconRegion.notifyOnEntry = YES;
    self.beaconRegion1.notifyOnEntry = YES;
    self.beaconRegion2.notifyOnEntry = YES;

    self.beaconRegion.notifyOnExit = YES;
    self.beaconRegion1.notifyOnExit = YES;
    self.beaconRegion2.notifyOnExit = YES;
    [self.beaconManager requestAlwaysAuthorization];

    [self.beaconManager startMonitoringForRegion:self.beaconRegion];
    [self.beaconManager startMonitoringForRegion:self.beaconRegion1];
    [self.beaconManager startMonitoringForRegion:self.beaconRegion2];

    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    if ([UIApplication respondsToSelector:@selector(registerUserNotificationSettings:)]) 
        UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                        UIUserNotificationTypeBadge |
                                                        UIUserNotificationTypeSound);
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
                                                                                 categories:nil];
        [application registerUserNotificationSettings:settings];
        [application registerForRemoteNotifications];
    
    return YES;


- (void)beaconManager:(CLLocationManager *)manager didEnterRegion:(CLBeaconRegion *)region

    // On enter 
    UILocalNotification *notification = [UILocalNotification new];
    if ([region.identifier isEqualToString:self.beaconRegion.identifier]) 
        NSLog(@"MintEnter");
        notification.alertBody = @"You Have Entered Region 1";
        notification.soundName = UILocalNotificationDefaultSoundName;
        notification.category = @"MintEnter";
        [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    
    else if ([region.identifier isEqualToString:self.beaconRegion1.identifier])
        NSLog(@"IceEnter");
        notification.alertBody =   @"You Have Entered Region 2";
        notification.soundName = UILocalNotificationDefaultSoundName;
        notification.category = @"IceEnter";
        [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    
    else if ( [region.identifier isEqualToString:self.beaconRegion2.identifier])
        NSLog(@"BlueBerryEnter");
        notification.alertBody = @"You Have Entered Region 3";
        notification.soundName = UILocalNotificationDefaultSoundName;
        notification.category = @"BlueBerryEnter";
        [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    




请在这方面帮助我。

【问题讨论】:

你能实现monitoringDidFail委托并检查它是否抛出任何东西吗?您是否还可以实现didDetermineState 委托并检查它为您定义的信标区域报告的状态?它应该在您开始监控几秒钟后自动调用。 所有代表都已实现,问题出在 iOS 9.0.2 更新到 iOS9.1 后,它就像一个魅力。 【参考方案1】:

当我将 iOS 9.0.2 更新到 iOS 9.1 时,我发现解决方案问题出现在通知区域中。

【讨论】:

以上是关于Estimote iBeacons 监控无法在 iOS 9.0.2 上运行的主要内容,如果未能解决你的问题,请参考以下文章

Ionic 应用程序未在 iOS 上检测到 iBeacons (cordova-plugin-estimote)

带有 Estimote iBeacon 的 IOS 存折

无法开始工作 ibeacon 演示应用程序

我如何知道 iBeacons 的纬度 (X) 和经度 (Y) 位置

在蓝牙重置之前,蓝牙设备在测距和监控 iBeacons 后无法连接

iBeacon 监控无法正常工作