ibecon后台运行
程序被硬关闭后,只能执行这三个回调,而且必须写在appdelegate中,退出ibeacons信息区域时会有延时10秒左右,进入时无延时
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region;
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region;
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region ;
程序被硬关闭后,不能执行回调,之前就是犯错误在这了
- (void)locationManager:(CLLocationManager *)manager
didRangeBeacons:(NSArray *)beacons
inRegion:(CLBeaconRegion *)region;
appdelegate中这样声明即可:
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
然后在页面中启动检测ibeacons信息位置:
NSUUID *proximityUUID = [[NSUUID alloc] initWithUUIDString:kUUID];
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:proximityUUID identifier:kIdentifier];
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.activityType = CLActivityTypeFitness;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
//搜索附近ibeacons
[self.locationManager startMonitoringForRegion:self.beaconRegion];
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
[self.locationManager requestStateForRegion:self.beaconRegion];
然后在plist文件中添加Required background modes选项,增加三个值
App communicates using CoreBluetooth,App shares data using CoreBluetooth,App registers for location updates
然后就可以自己玩了。详尽参考apple的demo-airlocate
附链接https://github.com/linlinqi/AirLocate
ibecon后台运行的更多相关文章
- Linux scp 设置nohup后台运行
Linux scp 设置nohup后台运行 1.正常执行scp命令 2.输入ctrl + z 暂停任务 3.bg将其放入后台 4.disown -h 将这个作业忽略HUP信号 5.测试会话中断,任务继 ...
- docker进入后台运行的容器
转载请注明出处 我们运行docker容器的时候,使用了-d参数,把容器在后台运行后. 这个时候,我们使用docker ps命令,我们就可以知道哪些程序在后台运行. 我们要怎么进入到docker ...
- python脚本后台运行
问题描述: 环境: CentOS6.4 一个用python写的监控脚本test1.py,用while True方式一直运行,在ssh远程(使用putty终端)时通过以下命令启动脚本: python t ...
- linux 让程序在后台运行的几种可靠方法
我们经常会碰到这样的问题,用 telnet/ssh 登录了远程的 Linux 服务器,运行了一些耗时较长的任务, 结果却由于网络的不稳定导致任务中途失败.如何让命令提交后不受本地关闭终端窗口/网络断开 ...
- linux进程后台运行及输出重定向
本机环境为ubuntu 14.04 以ping www.baidu.com为例: 1.程序的前台运行 ping www.baidu.com 可以看到,屏幕上输出了baidu返回的结果 2.实现程序后台 ...
- APP长时间后台运行
* 参考:http://www.nivalxer.com/archives/187 首先,我要说明的是在iOS中,一般应用程序在后台挂起之后仅拥有3分钟时间来处理相应的未完成事件,但是3分钟之后就会 ...
- iOS开发小技巧--iOS程序进入后台运行的实现
iOS程序进入后台运行的实现 视频中看到老师用的iOS7,代码中有开启timer,无限请求数据的功能,但是切换到后台,代码就不打印了 自己用的iOS9,进入后台还是可以打印的,再次进入前台也可以正常运 ...
- python程序一直在后台运行的解决办法
刚写了个python程序,要一直在后台运行,即使断开ssh进程也在,下面是解决办法: 假如Python程序为test.py 编写shell脚本start.sh #!/bin/bash python t ...
- tomcat 开机后台运行
引用:http://jingyan.baidu.com/article/a65957f4b12b8724e77f9b5a.html Tomcat是Apache 软件基金会(Apache Softwar ...
随机推荐
- PostgreSQL tips
tip 1 在sql中我们可以设置一个列自增长identity(1,1),但在postgresql中却没有这个关键字定义.但postgresql也有实现相关功能,那就是只需要将该列数据类型标记为ser ...
- C++ 矩阵计算库 :Eigen库
Eigen http://eigen.tuxfamily.org/index.php?title=Main_Page 下载http://bitbucket.org/eigen/eigen/get/3. ...
- UILabel标签文字过长时的显示方式
lineBreakMode:设置标签文字过长时的显示方式. label.lineBreakMode = NSLineBreakByCharWrapping; //以字符为显示单位显示,后面部分省略不显 ...
- 表变量、临时表(with as ,create table)
1.declare @t table(CountryRegionCode nvarchar(3))insert into @t(CountryRegionCode) (select CountryR ...
- std::condition_variable(2)复习
#include <iostream> // std::cout #include <thread> // std::thread, std::this_thread::yie ...
- 网络摄像机进行互联网视频直播录像方案的选择,EasyNVS or EasyCloud or EasyGBS?
背景需求 互联网视频直播越来越成为当前大势:直播的需求往往都伴随在录像的需求,对于录像,不同的场景又有不同的方案选择: 本篇博客将会介绍对应的几种录像方案,可以帮助有互联网录像需求的用户进行对应的录像 ...
- 2018.10.24-day3 python总结
昨日回顾:1.while2.运算符3.初始编码4.补充p2和p3的区别 Python2 (1) 今日学习目录1.整型 int() 2.布尔值 bool() 3.字符串详解 4. for循环
- 【题解】Zap(莫比乌斯反演)
[题解]Zap(莫比乌斯反演) 裸题... 直接化吧 [P3455 POI2007]ZAP-Queries 所有除法默认向下取整 \[ \Sigma_{i=1}^x\Sigma_{j=1}^y[(i, ...
- 007-搭建框架-开发AOP框架
一.代码地址 https://github.com/bjlhx15/smart-framework.git 二.代码编写 2.1.定义切面注解 增加Aspect注解 package com.lhx.s ...
- Way to OpenSource
@1:Follow any instructions in the readme and make sure that you can configure and run the project on ...