估计信标IOS-仅使用UUID值搜索信标

估计信标IOS-仅使用UUID值搜索信标,ios,objective-c,iphone,notifications,estimote,Ios,Objective C,Iphone,Notifications,Estimote,我喜欢Estimote Beacon应用程序开发,能够使用示例应用程序发送通知,其中UUID、主值和次值在代码中显式硬编码。我希望使用目标C实现以下要求 应用程序将根据UUID搜索信标,如果我有10个信标,则根据主值和次值区分信标,UUID保持不变 发送通知后,用户单击应用程序,应用程序应能够确定范围内信标的主要值和次要值 此外,是否可以在发送通知的同时进行自定义服务调用 我能够使用以下代码发送通知,其中包含硬编码的UUID、次要值和主要值 为我工作的代码如下所示: self.beaconNot

我喜欢Estimote Beacon应用程序开发,能够使用示例应用程序发送通知,其中UUID、主值和次值在代码中显式硬编码。我希望使用目标C实现以下要求

  • 应用程序将根据UUID搜索信标,如果我有10个信标,则根据主值和次值区分信标,UUID保持不变
  • 发送通知后,用户单击应用程序,应用程序应能够确定范围内信标的主要值和次要值
  • 此外,是否可以在发送通知的同时进行自定义服务调用
  • 我能够使用以下代码发送通知,其中包含硬编码的UUID、次要值和主要值

    为我工作的代码如下所示:

    self.beaconNotificationsManager = [BeaconNotificationsManager new];
    [self.beaconNotificationsManager enableNotificationsForBeaconID: [[BeaconID alloc] initWithUUIDString:@"MY UUID" major: 10708 minor:33584] enterMessage:@"Enter Message." exitMessage:@"Exit Message"];
    
    谢谢,
    SIB Mobile Developer

    您可以使用测距信标来实现发送“进入”和“退出”通知以及后台服务呼叫

    NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"YOURUUID"];
    
    self.beaconManager = [[ESTBeaconManager alloc] init];
    self.beaconManager.delegate = self;
    self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"RegionIdenifier"];
    
    self.beaconRegion.notifyOnEntry = YES;
    self.beaconRegion.notifyOnExit = YES;
    self.beaconRegion.notifyEntryStateOnDisplay = YES;
    
    然后在委托方法内发送通知:

    -(void)beaconManager:(ESTBeaconManager *)manager didEnterRegion:(CLBeaconRegion *)region
    {
        UILocalNotification *notification = [[UILocalNotification alloc] init];
        notification.alertBody = @"Enter region notification";
        notification.soundName = UILocalNotificationDefaultSoundName;
    
        [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    }
    
    -(void)beaconManager:(ESTBeaconManager *)manager didExitRegion:(CLBeaconRegion *)region
    {
        UILocalNotification *notification = [[UILocalNotification alloc] init];
        notification.alertBody = @"Exit region notification";
        notification.soundName = UILocalNotificationDefaultSoundName;
    
        [[UIApplication sharedApplication] presentLocalNotificationNow:notification];
    }