获取海拔高度. 实时气压
海拔高度
#import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h>@property (nonatomic , strong) CLLocationManager * locationManager; @property (nonatomic , strong) UILabel * altitude;//海拔 @property (nonatomic , strong) UILabel * verticalAccuracy;//垂直精度 self.locationManager = [[CLLocationManager alloc] init];self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;self.locationManager.delegate = self;[self.locationManager requestAlwaysAuthorization];[self.locationManager startUpdatingLocation];//实现回调 -(void)locationManager:(CLLocationManager *)managerdidUpdateToLocation:(CLLocation *)newLocationfromLocation:(CLLocation *)oldLocation {float altitude = newLocation.altitude;float verticalAccuracy = newLocation.verticalAccuracy;NSLog(@"%.2fm == %.2fm",altitude ,verticalAccuracy);self.altitude.text = [NSString stringWithFormat:@"海拔高度:%.2fm",altitude];self.verticalAccuracy.text = [NSString stringWithFormat:@"垂直精度 :%.2fm",verticalAccuracy]; }//error回调 -(void)locationManager:(CLLocationManager *)managerdidFailWithError:(NSError *)error {NSLog(@"error.userInfo:%@\nerror.domain:%@",error.userInfo,error.domain); }
实时气压
#import <CoreMotion/CMAltimeter.h>@property (nonatomic , strong) CMAltimeter *altimeter;//检测设备是否支持气压计if (![CMAltimeter isRelativeAltitudeAvailable]) {NSLog(@"Barometer is not available on this device. Sorry!");return;}//启用气压计 self.altimeter = [[CMAltimeter alloc]init];[self.altimeter startRelativeAltitudeUpdatesToQueue:NSOperationQueue.mainQueue withHandler:^(CMAltitudeData * _Nullable altitudeData, NSError * _Nullable error) {NSLog(@"%lf",[altitudeData.relativeAltitude floatValue]);NSLog(@"%@",error);}];
PS: iphone6以下 气压没有卵用.... iPhone SE 也没有卵用
转载于:https://www.cnblogs.com/-yun/p/7992269.html
获取海拔高度. 实时气压相关推荐
- sentinel 端口_Sentinel原理:控制台是如何获取到实时数据的
Sentinel 系列教程,现已上传到 github 和 gitee 中: GitHub: https://github.com/all4you/sentinel-tutorial Gitee: ht ...
- js获取用户实时地理位置
js获取用户实时地理位置 if(navigator.geolocation) {var id = navigator.geolocation.watchPosition(function(positi ...
- 微信公众号获取的实时坐标和高德地图坐标系的转换
refs: 1) https://blog.csdn.net/dragon974539495/article/details/78894499 2) https://www.jianshu.com/p ...
- Python利用PyQt5制作一个获取网络实时数据NBA数据播报GUI
现在NBA联赛也进行到半决赛了,我们怎么样才能以更快的方法获取NBA的数据呢?这里我们就自己来做一个数据播报的程序 文章目录 制作NBA数据爬虫 捋顺思路 编写代码 NBAReporter.py NB ...
- java代码获取银行实时汇率
java代码获取银行实时汇率 因为工作的时候甲方要求实施获取银行汇率,并且他们还不提供免费的接口,我就自己去网上找了接口,并写了实现代码,如果你需要的话直接复制粘贴就可以用了. 我用的是idea开发的 ...
- python 股票实时数据接口_获取股票实时数据的接口
记录下获取股票实时数据的接口,记录下. 以基金兴和500018为例 ****************************** 新浪的接口: http://hq.sinajs.cn/list=sh5 ...
- 用python读取股票价格_借助Python获取股票实时价格的操作方法
今天和大家分享一下使用Python获取股票实时价格的操作方法. 工具/原料 Python软件 可以联网的电脑 方法/步骤 1 要想获取股票数据,我们需要借助第三方模块.我们首先需要打开开始菜单. 2 ...
- esp8266 获取 NTP 实时时间
esp8266 获取 NTP 实时时间 esp8266 获取 NTP 实时时间 开发环境: 背景: NTPClient 库的安装 打开库 Demo 程序 程序设计 [WIFI连接] [NTP连接] [ ...
- 如何使用usb_cam和image_transport_plugins插件进行usb摄像头的视频获取和实时图像传输
如何使用usb_cam和image_transport_plugins插件进行usb摄像头的视频获取和实时图像传输 前言 一.使用usb_cam驱动进行usb摄像头的图像获取 二.使用image_tr ...
最新文章
- 面试官:你说你熟悉jvm?那你讲一下并发的可达性分析
- js对象与字符串相互转换
- 百万奖金!交通事件、医学病理、广告检测,江苏大数据开发与应用大赛报名...
- mysql_real_escape_string 报错_addslashes与mysql_real_escape_string的区别
- mysql查询2个isbn数据,数据库实验二 数据查询
- But don‘t be fooled, this phone does not
- C++是最难的编程语言?为什么这样说?
- Visual Studio 2010下载 + 附破解方法
- html用js连接sql,如何从浏览器中的JavaScript连接到SQL Server数据库?
- 5G NR CDRX
- 《Python程序设计》——2.2 字符串
- Unity烘焙时UV Overlap的解决办法
- odroid xu4安装ROS melodic+远程登录+Roboware 开发
- 如何打开阿里云安全组
- 鸿蒙喜欢吃什么,巴西龟吃什么食物,一般一天喂几次?
- linux相关的东东,来自dbanotes
- “时间都到哪里去了?”
- HPUX下虚拟技术IVM的使用整理
- 计算机歌曲数我的一个道姑朋友,LON《我的一个道姑朋友》[MP3-320K/11.2M]
- canal kafka camus整合
热门文章
- 交通流量预测数据集解读
- Python 中 'unicodeescape' codec can't decode bytes in position XXX: trun { cv.imread()的使用)}错误解决方案
- 华南农业大学计算机学院院长,华南农业大学外国语学院院长何高大
- 科技爱好者周刊(第 216 期):极简主义的胜利
- k8s-某视频课命令问题排查了解
- 姜小白的python日记day2 变量和循环
- Springboot项目整合xxl -job
- [secureCRT] session log保存 并添加时间戳
- 孢子社群:今日推荐人工智能微信群:智能群3群 智能大数据合作交流群
- 【TCP/IP】IP:网际协议(寻址和路由)