簡體   English   中英

Estimote iBeacons Monitoring無法在iOS 9.0.2上運行

[英]Estimote iBeacons Monitoring not working on iOS 9.0.2

我正在使用估算信標及其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];
    }



}

請在這方面幫助我。

當我將其更新為iOS 9.1時,通知解決方案問題出現在iOS版本9.0.2中,通知開始出現在通知區域中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM