gpt4 book ai didi

swift - CLLocationCoordinate2D 无法实例化

转载 作者:行者123 更新时间:2023-12-04 12:34:38 26 4
gpt4 key购买 nike

我正在尝试从我从文件中读取的数据创建一些“CLLocation”。第一步是实例化一个“CLLocationCoordinate2D”以输入到 CLLocation 的初始值设定项中。我正在 Playground 中尝试我的想法,这段非常简单的代码生成了一个运行时错误:

import CoreLocation

let lat = 48.8
let lon = -122.3
let point2D = CLLocationCoordinate2D(latitude: lat, longitude: lon)
错误信息是
error: Execution was interrupted, reason: signal SIGABRT.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
我对 Swift 编程很陌生,我不知道该怎么做。例如,我如何“使用”thread return -x“”来做任何事情
谁能告诉我这里发生了什么?
I've tried to attach a picture of the whole playground but can't tell if that is possible

最佳答案

刚刚发生在我身上。尝试更换 import CoreLocationimport MapKit这在我的情况下有效。

关于swift - CLLocationCoordinate2D 无法实例化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62762553/

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