使用MKMapRectMake创建MKMapRect会导致编译错误,如下所示:
这是我的代码:
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);
这是编译器的错误:
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)
我的解决方法是使用origin和size参数创建MKMapRect.请注意,我已将MKMapKit添加到Build Phases中的链接库中
有没有人遇到同样的问题以及你如何解决这个问题?