#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 下的定位跟踪测速的更多相关文章

  1. BJSV-P-002高精度测速一体机

    测速.抓拍.录像于一体,产品处于行业顶尖水平. 1        测速一体机参数 2       接口和资源 3      相机接口 1.       前面板接口 测速一体机镜头接口采用C-Mount ...

  2. Linux下3种常用的网络测速工具

    大家好,我是良许. 不管你用的是什么操作系统,网速都是你非常关心的一个性能指标,毕竟,谁都不想看个视频结果网速卡到你怀疑人生.本文介绍三个 Linux 命令行下的网络测速工具,让你随时随地知道你的网络 ...

  3. Linux下 网卡测速

    参考: How do I verify the speed of my NIC? Linux下 网卡测速 命令: $ sudo ethtool eth0 Settings for eth0: Supp ...

  4. Centos7限速和测速

    限速 wondershaper是国外人开发的一款在Linux内核下基于TC工具的对整块网卡的限度工具. 第一种安装方法 首先下载wondershaper的rpm安装包:wondershaper-1.1 ...

  5. 混合线路接入时,360、QQ管家等测速显示电信IP或任意线路的IP

    最近很多人QQ上问我,我有电信.联通接入,用户测速的时候有的时候显示联通的IP,可是我想让他显示为电信的IP,怎么办? 3年前开始使用联通的线路时,就这样设置了,有些人还拿这个设置当宝贝了???? 其 ...

  6. Android自动化页面测速在美团的实践

    背景 随着移动互联网的快速发展,移动应用越来越注重用户体验.美团技术团队在开发过程中也非常注重提升移动应用的整体质量,其中很重要的一项内容就是页面的加载速度.如果发生冷启动时间过长.页面渲染时间过长. ...

  7. 网络测速命令--speedtest

    网络测速 speedtest-cli 顾名思义,这个命令为网络测速命令,基于Python编写,测试系统网络的上传下载速度,GitHub托管的项目地址,以下列出常见的用法 安装命令 pip instal ...

  8. iOS炫酷动画图案、多种选择器、网络测速、滑动卡片效果等源码

    iOS精选源码 对网络进行测速 自实现大标题,配合原生骨架屏demo 简单方便的pickerVIew记录数据 LZPickerView 科技风绘制组件,简单快速"画"出炫酷图案 R ...

  9. 网络测速神器:SpeedTest深度指南

    最近在测试一个项目,里面涉及到一个测试case:在linux服务器上,当网络带宽较差时,观察服务的消息处理能力和表现.限制网卡带宽有许多方法,比如Wondershaper或者ethtool.那验证限速 ...

随机推荐

  1. Qt5.4 MSVC mysql驱动编译;

    http://www.mysql.com/ 下载mysql http://download.qt.io/archive/qt/     Qt 下载 1. mysql安装源码 注意勾选这一步,将mysq ...

  2. NGUI 滑动页(UIToggle和UIToggledObjects)

    1.NGUI->Create->Scroll View 2.给Scroll View添加一个 UIGrid,自己设置Arragement(横向竖向) 3.给Grid添加元素 4.给元素添加 ...

  3. VS2013,asp.net网站转换为web应用程序

    此功能已经不在右键菜单里了,而在主菜单中的“项目-->转换为WEB应用程序”

  4. AIX系统中安装Java6全过程(全部)

    ====================================================   From: GCG TSC pSeries <ibm800p@cn.ibm.com& ...

  5. LeetCode 326 Power of Three

    Problem: Given an integer, write a function to determine if it is a power of three. Could you do it ...

  6. 51nod 1070 Bash游戏 V4 (斐波那契博弈)

    题目:传送门. 有一堆个数为n(n>=2)的石子,游戏双方轮流取石子,规则如下: 1)先手不能在第一次把所有的石子取完,至少取1颗: 2)之后每次可以取的石子数至少为1,至多为对手刚取的石子数的 ...

  7. asp.net 短信群发

    protected void Btn_Save_Click(object sender, EventArgs e) { string Contents = this.Txt_SmsContents.T ...

  8. iOS中UITableView的一些设置

    不可滑动: ? 1 tableView.userInteractionEnabled = NO; 也可以在storyboard中的userInteractionEnable属性设置 显示导向箭头: ? ...

  9. iOS开发UI篇—UIScrollView控件实现图片缩放功能

    iOS开发UI篇—UIScrollView控件实现图片缩放功能 一.缩放 1.简单说明: 有些时候,我们可能要对某些内容进行手势缩放,如下图所示 UIScrollView不仅能滚动显示大量内容,还能对 ...

  10. [Android Pro] 将你的安卓手机屏幕共享到PC或Mac上

    有时候为了方便演示一个手机app,需要把手机屏幕显示到PC或Mac上.这里提供一个方法 — 使用Vysor达到此功能. Vysor的吸引力在于3个方面: 它适用于Windows.Linux或Mac. ...