该应用将2个proximityUUID设置为区域(它们具有不同的ID),
并开始如下所示.
#pragma mark - CLLocationManagerDelegate(voID)locationManager:(CLLocationManager *)managerdIDEnterRegion:(CLRegion *)region { [self.locationManager requestStateForRegion:(CLBeaconRegion *)region];}- (voID)locationManager:(CLLocationManager *)manager dIDExitRegion:(CLRegion *)region { [self.locationManager stopRangingBeaconsInRegion:(CLBeaconRegion *)region]; }- (voID)locationManager:(CLLocationManager *)managerdIDRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{ for(CLBeacon* b in beacons){ //output only prevIoUs beacon if it's before regionout to prevIoUs region NSLog(@"%@",b); }}- (voID)locationManager:(CLLocationManager *)manager dIDFailWithError:(NSError *)error { //error}- (voID)locationManager:(CLLocationManager *)manager dIDDetermineState:(CLRegionState)state forRegion:(CLRegion *)region{ if(state == CLRegionStateInsIDe){ if ([region isMemberOfClass:[CLBeaconRegion class]] && [CLLocationManager isRangingAvailable]){ [self.locationManager startRangingBeaconsInRegion:(CLBeaconRegion *)region]; } }}
它适用于iOS 8和iOS 9,但在iOS 10中不起作用.
[在iOS 8 / iOS 9中]
1.broadcast beacon12.[app]dIDRangeBeacons (beacon1)3.stop beacon1 and broadcast beacon24.[app]dIDRangeBeacons (beacon2)
[iOS 10]
1.broadcast beacon12.[app]dIDRangeBeacons (beacon1)3.stop beacon1 and broadcast beacon24.[app]dIDRangeBeacons (**beacon1**)
这是iOS 10的错误吗?
解决方法 好吧,我在Swift 3中遇到了同样的问题,但我解决了它.似乎有两件事(可能直接相关):
>对于iOS10,信标的广告间隔可能设置得太高(将其设置为大约200毫秒,然后它应该适用于9和10,正如Macrumors上的dantastic所建议的那样)>我是如何重新开始工作的:我在iOS 9.3.5的iPad上进行了测试,需要将部署目标更改为9.3.这表明它在我的iPad上再次使用iOS 9,但是……也在我的iOS 10设备上解决了它.
总结以上是内存溢出为你收集整理的iOS 10中的测距信标全部内容,希望文章能够帮你解决iOS 10中的测距信标所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)