CLLocationDistance转换 [英] CLLocationDistance conversion

查看:280
本文介绍了CLLocationDistance转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CLLocationDistance类型的变量中有距离我需要将它转换为整数变量我该怎么做

i have distance in a variable of type CLLocationDistance i need to convert it in a integer variable how can i do it

我使用

CLLocationDistance kilometers;

int distance = [kilometers intValue];

但是给出错误。

帮助伙计

推荐答案

https://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html

distanceFromLocation:

返回从接收者位置到指定位置的距离(以米为单位)。

- (CLLocationDistance)distanceFromLocation:(const CLLocation *)location

参数

位置另一个位置。

返回值
两个位置之间的距离(以米为单位)。

Return Value The distance (in meters) between the two locations.

返回类型是 double 不是 int 。它不是 NSNumber

return type is double not int. And its not an NSNumber.

这篇关于CLLocationDistance转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆