gpt4 book ai didi

iphone - 将 nsnumber 或 nsstring 放入 initWithLatitude :

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:31:59 24 4
gpt4 key购买 nike

我也被困住了,我也很愚蠢,我正在尝试将 NSStringNSNumber 放入 initWithLatitude >CLLocation。如果有人能提供帮助,那就太好了。

代码如下

CLLocation *location1 = [[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887];
CLLocation *location2 = [[CLLocation alloc] initWithLatitude:53.683267 longitude:-0.011330];
label.text = [NSString stringWithFormat:@"Distance in miles: %4.1f", [location1 distanceFromLocation:location2]/1609.344];
[location1 release];

我正在尝试将 [[CLLocation alloc] initWithLatitude:53.778702 longitude:-0.271887] 替换为 [[CLLocation alloc] initWithLatitude:lat longitude:lon]

最佳答案

CLLocationDegrees 是一个double,所以你可以

[[CLLocation alloc] initWithLatitude:[someNSNumber doubleValue] longitude:[someNSString doubleValue]];

关于iphone - 将 nsnumber 或 nsstring 放入 initWithLatitude :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11837051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com