CoreLocation 下的定位跟踪测速
#import "ViewController.h"
#import <CoreLocation/CoreLocation.h>
@interface ViewController ()<CLLocationManagerDelegate>
@property(nonatomic,strong)CLLocationManager*manager;;
@property(nonatomic,strong)CLLocation *preLocation;
@property(nonatomic,assign)NSTimeInterval sumtime;
@property(nonatomic,assign)CGFloat sumDistance;
@end
@implementation ViewController
-(CLLocationManager*)manager
{
if (_manager==nil) {
_manager=[[CLLocationManager alloc]init];
}
return _manager;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.manager.delegate=self;
//判断ios7 或者8
if([[UIDevice currentDevice].systemVersion doubleValue]>8.0)
{
//[self.manager requestWhenInUseAuthorization];
[self.manager requestAlwaysAuthorization];
}
[self.manager startUpdatingLocation];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *newLocation=[locations lastObject];
if (self.preLocation==nil) {
CLLocationDirection dierction=[newLocation distanceFromLocation:self.preLocation ];
NSTimeInterval dTime=[newLocation.timestamp timeIntervalSinceDate:self.preLocation.timestamp];
//计算速度
CGFloat speed=dierction /dTime;
self.sumDistance+=dierction;
self.sumtime+=dTime;
//平均速度
CGFloat averageSpeed=self.sumDistance/self.sumtime;
NSLog(@"行驶距离%f\n当前速度%f\n平均速度%f\n",self.sumDistance,speed,averageSpeed);
}
self.preLocation=newLocation;
}
@end
CoreLocation 下的定位跟踪测速的更多相关文章
- BJSV-P-002高精度测速一体机
测速.抓拍.录像于一体,产品处于行业顶尖水平. 1 测速一体机参数 2 接口和资源 3 相机接口 1. 前面板接口 测速一体机镜头接口采用C-Mount ...
- Linux下3种常用的网络测速工具
大家好,我是良许. 不管你用的是什么操作系统,网速都是你非常关心的一个性能指标,毕竟,谁都不想看个视频结果网速卡到你怀疑人生.本文介绍三个 Linux 命令行下的网络测速工具,让你随时随地知道你的网络 ...
- Linux下 网卡测速
参考: How do I verify the speed of my NIC? Linux下 网卡测速 命令: $ sudo ethtool eth0 Settings for eth0: Supp ...
- Centos7限速和测速
限速 wondershaper是国外人开发的一款在Linux内核下基于TC工具的对整块网卡的限度工具. 第一种安装方法 首先下载wondershaper的rpm安装包:wondershaper-1.1 ...
- 混合线路接入时,360、QQ管家等测速显示电信IP或任意线路的IP
最近很多人QQ上问我,我有电信.联通接入,用户测速的时候有的时候显示联通的IP,可是我想让他显示为电信的IP,怎么办? 3年前开始使用联通的线路时,就这样设置了,有些人还拿这个设置当宝贝了???? 其 ...
- Android自动化页面测速在美团的实践
背景 随着移动互联网的快速发展,移动应用越来越注重用户体验.美团技术团队在开发过程中也非常注重提升移动应用的整体质量,其中很重要的一项内容就是页面的加载速度.如果发生冷启动时间过长.页面渲染时间过长. ...
- 网络测速命令--speedtest
网络测速 speedtest-cli 顾名思义,这个命令为网络测速命令,基于Python编写,测试系统网络的上传下载速度,GitHub托管的项目地址,以下列出常见的用法 安装命令 pip instal ...
- iOS炫酷动画图案、多种选择器、网络测速、滑动卡片效果等源码
iOS精选源码 对网络进行测速 自实现大标题,配合原生骨架屏demo 简单方便的pickerVIew记录数据 LZPickerView 科技风绘制组件,简单快速"画"出炫酷图案 R ...
- 网络测速神器:SpeedTest深度指南
最近在测试一个项目,里面涉及到一个测试case:在linux服务器上,当网络带宽较差时,观察服务的消息处理能力和表现.限制网卡带宽有许多方法,比如Wondershaper或者ethtool.那验证限速 ...
随机推荐
- svn: Commit failed (details follow): svn: Authorization failed
我的原因是我没有使用账户密码,匿名用户没有写权限,只有只读的权限 修改下svn配置文件中的anon-access=read为anon-access=write 还有一点要注意:选项前面不能留空格,必须 ...
- 对于Tomcat服务器环境变量和启动配置的一点补充
我们之前第一次使用Tomcat服务器运行jsp应用时,曾经给Tomcat配置过一个环境变量CATALINA_HOME,这个变量指定了Tomcat的安装位置,对于多个开发项目,我们一般会释放多个tomc ...
- 批处理命令——goto 和 :
谈起goto,相信大家应该想到的是面向过程编程.其实,这就相当于当有人向你谈起class,意味着你就懂得面向对象编程.如果你不懂,那么你们的沟通将会很困难.不懂我说的啥意思吗?请参见曾经分享王路的一篇 ...
- 【资料】Boost的资料
http://blog.csdn.net/pongba/article/details/1561110
- struts2截取字符串
<struts:if test="null!=pushAd&&pushAd.length()>14"> <struts:property v ...
- C#实现把指定文件夹下的所有文件复制到指定路径下以及修改指定文件的后缀名
1.实现把指定文件夹下的所有文件复制到指定路径下 public static void copyFiles(string path) { DirectoryInfo dir = new Directo ...
- tableView滚到最后一行
dispatch_async(dispatch_get_main_queue(), ^{ [_tableview scrollToRowAtIndexPath:[NSIndexPath indexPa ...
- 从xml中构建sqlSessionFactory
String resource = "org/mybatis/example/Configuration.xml"; Reader reader = Resources.getRe ...
- php单双引号
1.定义字符串 定义字符串时,只有一种引号被视为定义符,即单引号或双引号.于是,如果一个字符串由双引号开始,那么只有双引号被分析器解析.这样,你就可以在双引号串中包含任何其他字符,甚至单引号.下面的引 ...
- mysql中select五种子句和统计函数
select 五种子句顺序 where 条件 group by 分组 having 把结果进行再次筛选 order by 排序 limit 取出条目 统计函数 max(列名) 求最大 min( ...