网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

iOS7的iBeacon初步使用-创新互联

iBeacon是iOS7的新增的功能,通过BLE实现室内定位,精确到厘米级别。

成都创新互联公司专注于临邑网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供临邑营销型网站建设,临邑网站制作、临邑网页设计、临邑网站官网定制、小程序制作服务,打造临邑网络公司原创品牌,更为您提供临邑网站排名全网营销落地服务。

测试使用两台iPhone(支持BLE),一台作为iBeacon基站广播信号,代码使用官方源码AirLocate,另外一台作为接收端,直接使用的是App Store下载的AirLocate)。

1、广播端主要代码

NSDictionary *peripheralData = nil;
        region= [[CLBeaconRegion alloc] initWithProximityUUID:self.uuid major:[self.major shortValue]
                minor:[self.minor shortValue] identifier:BeaconIdentifier]; peripheralData= [region peripheralDataWithMeasuredPower:power]; // The region's peripheral data contains the CoreBluetooth-specific data we need to advertise. if(peripheralData) {
        //开始广播
        [peripheralManager startAdvertising:peripheralData];
     }

2、接收端主要代码

  self.locationManager = [[CLLocationManager alloc] init];
  self.locationManager.delegate = self;

   //接收端的uuid数组需要包含广播端的uuid  for (NSUUID *uuid in [APLDefaults sharedDefaults].supportedProximityUUIDs)
    {
        CLBeaconRegion*region = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:[uuid UUIDString]];
        self.rangedRegions[region]= [NSArray array];
    }
 
for (CLBeaconRegion *region in self.rangedRegions)
    {
        [self.locationManager startRangingBeaconsInRegion:region];
    }

 

官方源码AirLocate:https://developer.apple.com/library/ios/samplecode/AirLocate/Introduction/Intro.html

App Store地址:https://itunes.apple.com/cn/app/airlocate/id716260068?mt=8


分享题目:iOS7的iBeacon初步使用-创新互联
文章地址:http://bjjierui.cn/article/dsdcos.html

其他资讯