- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在为区域监控编写原型(prototype)类型。下面是我的一组代码
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager requestWhenInUseAuthorization];//commented for iOS 7
这就是我创建 locationManager 的方式
在plist中,
<key>NSLocationAlwaysUsageDescription</key>
<string>Location is required to find out where you are</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location is required to find out where you are</string>
然后
-(BOOL) checkLocationManager
{
if(![CLLocationManager locationServicesEnabled])
{
[self showMessage:@"You need to enable Location Services"];
return FALSE;
}
if(![CLLocationManager isMonitoringAvailableForClass:[CLRegion class]])
{
[self showMessage:@"Region monitoring is not available for this Class"];
return FALSE;
}
if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied ||
[CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted )
{
[self showMessage:@"You need to authorize Location Services for the APP"];
return FALSE;
}
return TRUE;
}
我正在检查那些条件
-(void) addGeofence:(NSDictionary*) dict
{
CLRegion * region = [self dictToRegion:dict];
[locationManager startMonitoringForRegion:region];
}
- (CLRegion*)dictToRegion:(NSDictionary*)dictionary
{
NSString *identifier = [dictionary valueForKey:@"identifier"];
CLLocationDegrees latitude = [[dictionary valueForKey:@"latitude"] doubleValue];
CLLocationDegrees longitude =[[dictionary valueForKey:@"longitude"] doubleValue];
CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake(latitude, longitude);
CLLocationDistance regionRadius = [[dictionary valueForKey:@"radius"] doubleValue];
if(regionRadius > locationManager.maximumRegionMonitoringDistance)
{
regionRadius = locationManager.maximumRegionMonitoringDistance;
}
NSString *version = [[UIDevice currentDevice] systemVersion];
CLRegion * region =nil;
if([version floatValue] >= 7.0f) //for iOS7
{
region = [[CLCircularRegion alloc] initWithCenter:centerCoordinate
radius:regionRadius
identifier:identifier];
}
else // iOS 7 below
{
region = [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate
radius:regionRadius
identifier:identifier];
}
return region;
}
这组代码在 iOS 7 上完美运行。
但是当我在 iOS 8 中运行相同的程序时,当我开始监视时,将调用委托(delegate)方法 didStartMonitoringForRegion
。但是当我进入该区域时,didEnterRegion
从未被调用。
对于 iOS 8,有什么我应该特别注意的吗?
最佳答案
区域监控需要用户授权始终。这是 iOS8 的新功能。
关于ios - iOS 8 中的 didEnterRegion - 区域监控,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30365637/
我已经在 ubuntu 14.0 上成功安装了 Zabbix 3.2 服务器主机上的 Z 是绿色的。不幸的是,JMX 是红色的。 Zabbix 服务器:192.168.1.112 带有 tomcat
我想制作一个仪表板,显示我们的 Azure 服务总线队列的状态,并显示“添加到队列的消息”、“队列长度”和“已处理的消息”等的历史记录。使用 Azure 管理门户,我可以看到,这些统计信息大部分是手动
我的 MYSQL 每天晚上都有事件,但我不太确定发生了什么,因为即使我将其设置得早于其他事件,它仍然在早上运行。 问题是,我如何检查运行事件的历史记录或日志,哪一个晚上锁了,哪一个是跑了没跑? 谢谢
1、监控log文件大小超过10g的server 和db 复制代码代码如下: create procedure db_sendmail_mssqllogsize as&n
本教程讨论如何使用 AspectJ 开源框架监控 Spring 应用程序在方法执行方面的性能。 传统上,监控每个 Java 方法所花费的时间的最简单方法是在方法的开头和结尾包含一些跟踪行: publi
有什么可以帮助 msmq 监控的吗?当消息出现在队列中并且在休假时相同时,我想获得一些事件/监视器。 最佳答案 查看 Windows 管理性能计数器。 如果您查看管理工具并找到“性能计数器”,您将能够
我的 Tomcat 中的一个巨大的 web 应用程序有时会开始使用过多的 DBCP 连接,从而导致问题。 为了进行调查,我想在每个时间点准确地知道什么线程/方法持有池的连接。不需要是实时的,事后分析就
在浏览器的整个页面生命周期中监视 cookie 并在 cookie 更改时触发事件的最佳 JS 或 JQuery 特定方法是什么? 最佳答案 据我所知,不可能将 change (或类似)事件直接绑定(
我想尽可能详细地报告我的笔记本的执行情况。简而言之,我想实时查看我的笔记本正在执行的每个操作。例如,我的一个函数有一个 sleep 周期为 5 秒的循环,我希望看到程序实际上正在 sleep 并且循环
Azure 容器服务是否与 Azure Monitor 集成?想知道对 kubernetes 集群进行日志记录/监控的最佳方法是什么? 最佳答案 如果您正在 Azure 上寻找监视工具,您可能需要使用
我一直在尝试使用 erlang:monitor/2 来监视 gen_server。不幸的是,每次我尝试这个时,Erlang shell 都会进入无限循环。 这是我为测试这一点而编写的测试程序。 -mo
Azure 容器服务是否与 Azure Monitor 集成?想知道对 kubernetes 集群进行日志记录/监控的最佳方法是什么? 最佳答案 如果您正在 Azure 上寻找监视工具,您可能需要使用
我想使用 编写一个 shell 脚本来监控集群中的消费者滞后 bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zkconnect
在 .NET 中,假设 thread A 锁定了一个对象。同时,线程B和线程C被阻塞,等待线程A解锁对象。 现在,线程 A 解锁了对象。接下来将选择哪个线程(B 或 C)?它是如何确定的? 最佳答案
我搜索过这个主题,但发现很少有有用的细节。有了这些细节,我尝试编写一些代码如下。 注意:在将此帖子标记为重复之前,请将此帖子中共享的详细信息与其他帖子进行比较,而不仅仅是按主题。 - (NSArray
目录 1、指标监控 2、常用的监控端点 3、定制EndPoint 4、spring boot admin(可以使用)
我们使用 Prometheus 和 Grafana 来监控我们的 Kafka 集群。 在我们的应用程序中,我们使用 Kafka 流,Kafka 流有可能因异常而停止。我们正在记录事件 setUnCau
我正在建立一个复杂的网络仿真,并试图捕捉一些重要的性能测量。 我在服务器上运行了 mininet,并且我将视频从一个 mininet 主机流式传输到另一个(使用 -nodisp 选项,因为我没有 GU
Jenkins 的 openstack-plugin 使用 openstack4j 与 openstack 云对话。我正在寻找一种方法,我们可以从客户端的角度监控 openstack4j 所做的 ht
我正在处理一项需要监控 Thunderbolt 端口连接变化的要求。 (当连接或断开 Thunderbolt 电缆时)。 我尝试使用 IOServiceMatching(kIOUSBInterface
我是一名优秀的程序员,十分优秀!