Using MKMapRectMake to create MKMapRect causes compiling error as below:
This is my code:
var lat = 37.33072
var lon = -122.029674
var loc = CLLocationCoordinate2D(latitude: lat, longitude: lon)
var point = MKMapPointForCoordinate(loc)
var flyTo = MKMapRectMake(point.x, point.y, 0, 0);
and this is the error from the compiler:
Undefined symbols for architecture i386:
"_MKMapPointMake", referenced from:
_MKMapRectMake in ViewController.o
"_MKMapSizeMake", referenced from:
_MKMapRectMake in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My work-around for this is create MKMapRect using the origin and size parameters. Note that I have added MKMapKit to the linked libraries in Build Phases
Is there anyone encounter the same issue and how you fix this?
Work around it with a utility function:
func myMKMapRect(x: Double, y:Double, w:Double, h:Double) -> MKMapRect {
return MKMapRect(origin:MKMapPoint(x:x, y:y), size:MKMapSize(width:w, height:h))
}
And file a bug report with Apple, of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With