CLLocationCoordinate2D can't be instantiated
Asked Answered
A

2

5

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

After answered 6/7, 2020 at 18:47 Comment(2)
its not crashing here sir .. i double check it in playground ... are you using xcode ?Chryso
Weirdly, I'm getting the same crash on my Xcode-playgrounds too.Dimer
A
2

Frankenstein was right - it must be an Xcode bug. I put the same code in a "real" program and no problem.

After answered 7/7, 2020 at 13:49 Comment(0)
I
12

Just happened to me. Try to replace import CoreLocation with import MapKit that's worked in mу case.

Ichthyology answered 16/10, 2020 at 6:42 Comment(0)
A
2

Frankenstein was right - it must be an Xcode bug. I put the same code in a "real" program and no problem.

After answered 7/7, 2020 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.