问题
I am trying to create some "CLLocation"s from data that I've read from a file. The first step is to instantiate a "CLLocationCoordinate2D" to be fed into the initializer for CLLocation. I'm trying out my ideas in a Playground and this very simple code generates a runtime error:
import CoreLocation
let lat = 48.8
let lon = -122.3
let point2D = CLLocationCoordinate2D(latitude: lat, longitude: lon)
Error message is
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.
I am pretty new to Swift programming and I have no idea what to do with any of this. E.g., how do I "use "thread return -x" " to do anything Can anyone tell me what's going on here?
I've tried to attach a picture of the whole playground but can't tell if that is possible
回答1:
Frankenstein was right - it must be an Xcode bug. I put the same code in a "real" program and no problem.
回答2:
Just happened to me. Try to replace import CoreLocation
with import MapKit
that's worked in me case.
来源:https://stackoverflow.com/questions/62762553/cllocationcoordinate2d-cant-be-instantiated